index.js — react Source File
Architecture documentation for index.js, a javascript file in the react codebase. 1 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 4e35c5dd_71d5_49a7_889a_723a2a42e43e["index.js"] ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] 4e35c5dd_71d5_49a7_889a_723a2a42e43e --> ac587885_e294_a1e9_b13f_5e7b920fdb42 30d76895_4832_9ca3_9e81_e0cdf028c09c["index.js"] 30d76895_4832_9ca3_9e81_e0cdf028c09c --> 4e35c5dd_71d5_49a7_889a_723a2a42e43e style 4e35c5dd_71d5_49a7_889a_723a2a42e43e 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';
function deferred<T>(
timeoutMS: number,
resolvedValue: T,
displayName: string,
): Promise<T> {
const promise = new Promise<T>(resolve => {
setTimeout(() => resolve(resolvedValue), timeoutMS);
});
(promise as any).displayName = displayName;
return promise;
}
const title = deferred(100, 'Segmented Page Title', 'title');
const content = deferred(
400,
'This is the content of a segmented page. It loads in multiple parts.',
'content',
);
function Page(): React.Node {
return (
<article>
<h1>{title}</h1>
<p>{content}</p>
</article>
);
}
function InnerSegment({children}: {children: React.Node}): React.Node {
return (
<>
<h3>Inner Segment</h3>
<React.Suspense name="InnerSegment" fallback={<p>Loading...</p>}>
<section>{children}</section>
<p>After inner</p>
</React.Suspense>
</>
);
}
const cookies = deferred(200, 'Cookies: 🍪🍪🍪', 'cookies');
function OuterSegment({children}: {children: React.Node}): React.Node {
return (
<>
<h2>Outer Segment</h2>
<React.Suspense name="OuterSegment" fallback={<p>Loading outer</p>}>
<p>{cookies}</p>
<div>{children}</div>
<p>After outer</p>
</React.Suspense>
</>
);
}
function Root({children}: {children: React.Node}): React.Node {
return (
<>
<h1>Root Segment</h1>
<React.Suspense name="Root" fallback={<p>Loading root</p>}>
<main>{children}</main>
<footer>After root</footer>
</React.Suspense>
</>
);
}
const dynamicData = deferred(10, 'Dynamic Data: 📈📉📊', 'dynamicData');
export default function Segments(): React.Node {
return (
<>
<p>{dynamicData}</p>
<React.Activity name="root" mode="visible">
<Root>
<React.Activity name="outer" mode="visible">
<OuterSegment>
<React.Activity name="inner" mode="visible">
<InnerSegment>
<React.Activity name="slot" mode="visible">
<Page />
</React.Activity>
</InnerSegment>
</React.Activity>
</OuterSegment>
</React.Activity>
</Root>
</React.Activity>
</>
);
}
Domain
Subdomains
Functions
Dependencies
- react
Imported By
Source
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 1 function(s): promise.
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/Segments/index.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shell/src/app/Segments).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free