Home / File/ index.js — react Source File

index.js — react Source File

Architecture documentation for index.js, a javascript file in the react codebase. 1 imports, 1 dependents.

File javascript BabelCompiler Validation 1 imports 1 dependents 6 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  00568843_3949_1727_d0d0_78bc6c834b68["index.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  00568843_3949_1727_d0d0_78bc6c834b68 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  30d76895_4832_9ca3_9e81_e0cdf028c09c["index.js"]
  30d76895_4832_9ca3_9e81_e0cdf028c09c --> 00568843_3949_1727_d0d0_78bc6c834b68
  style 00568843_3949_1727_d0d0_78bc6c834b68 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.
 *
 * @flow
 */

import * as React from 'react';
import {
  createContext,
  forwardRef,
  lazy,
  memo,
  Component,
  Fragment,
  Profiler,
  StrictMode,
  Suspense,
} from 'react';

const Context = createContext('abc');
Context.displayName = 'ExampleContext';

class ClassComponent extends Component<any> {
  render(): null {
    return null;
  }
}

function FunctionComponent() {
  return null;
}

const MemoFunctionComponent = memo(FunctionComponent);

const ForwardRefComponentWithAnonymousFunction = forwardRef((props, ref) => (
  <ClassComponent ref={ref} {...props} />
));
const ForwardRefComponent = forwardRef(function NamedInnerFunction(props, ref) {
  return <ClassComponent ref={ref} {...props} />;
});
const ForwardRefComponentWithCustomDisplayName = forwardRef((props, ref) => (
  <ClassComponent ref={ref} {...props} />
));
ForwardRefComponentWithCustomDisplayName.displayName = 'Custom';

const LazyComponent = lazy(() =>
  Promise.resolve({
    default: FunctionComponent,
  }),
);

export default function ElementTypes(): React.Node {
  return (
    <Profiler id="test" onRender={() => {}}>
      <Fragment>
        <Context.Provider value={'def'}>
          <Context.Consumer>{(value: $FlowFixMe) => null}</Context.Consumer>
        </Context.Provider>
        <StrictMode>
          <Suspense fallback={<div>Loading...</div>}>
            <ClassComponent />
            <FunctionComponent />
            <MemoFunctionComponent />
            <ForwardRefComponent />
            <ForwardRefComponentWithAnonymousFunction />
            <ForwardRefComponentWithCustomDisplayName />
            <LazyComponent />
          </Suspense>
        </StrictMode>
      </Fragment>
    </Profiler>
  );
}

Domain

Subdomains

Classes

Dependencies

  • react

Frequently Asked Questions

What does index.js do?
index.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 index.js?
index.js defines 6 function(s): ElementTypes, ForwardRefComponent, ForwardRefComponentWithAnonymousFunction, ForwardRefComponentWithCustomDisplayName, FunctionComponent, LazyComponent.
What does index.js depend on?
index.js imports 1 module(s): react.
What files import index.js?
index.js is imported by 1 file(s): index.js.
Where is index.js in the architecture?
index.js is located at packages/react-devtools-shell/src/app/ElementTypes/index.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shell/src/app/ElementTypes).

Analyze Your Own Codebase

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

Try Supermodel Free