Home / File/ right.js — react Source File

right.js — react Source File

Architecture documentation for right.js, a javascript file in the react codebase. 2 imports, 0 dependents.

File javascript BabelCompiler Validation 2 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  195fdf06_dc9f_fedb_0194_c0dae73878c0["right.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  195fdf06_dc9f_fedb_0194_c0dae73878c0 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  8792c1c1_dca5_f137_73ea_c0e268fdbb22["client"]
  195fdf06_dc9f_fedb_0194_c0dae73878c0 --> 8792c1c1_dca5_f137_73ea_c0e268fdbb22
  style 195fdf06_dc9f_fedb_0194_c0dae73878c0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

import * as React from 'react';
import {useLayoutEffect, useRef, useState} from 'react';
import {createRoot} from 'react-dom/client';

function createContainer() {
  const container = document.createElement('div');

  ((document.body: any): HTMLBodyElement).appendChild(container);

  return container;
}

function EffectWithState() {
  const [didMount, setDidMount] = useState(0);

  const renderCountRef = useRef(0);
  renderCountRef.current++;

  useLayoutEffect(() => {
    if (!didMount) {
      setDidMount(true);
    }
  }, [didMount]);

  return (
    <ul>
      <li>Rendered {renderCountRef.current} times</li>
      {didMount && <li>Mounted!</li>}
    </ul>
  );
}

createRoot(createContainer()).render(<EffectWithState />);

Domain

Subdomains

Dependencies

  • client
  • react

Frequently Asked Questions

What does right.js do?
right.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in right.js?
right.js defines 2 function(s): EffectWithState, createContainer.
What does right.js depend on?
right.js imports 2 module(s): client, react.
Where is right.js in the architecture?
right.js is located at packages/react-devtools-shell/src/multi/right.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shell/src/multi).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free