index.js — react Source File
Architecture documentation for index.js, a javascript file in the react codebase. 2 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 3a02e121_a575_f687_567f_39a3a9f90904["index.js"] d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"] 3a02e121_a575_f687_567f_39a3a9f90904 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07 ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] 3a02e121_a575_f687_567f_39a3a9f90904 --> ac587885_e294_a1e9_b13f_5e7b920fdb42 30d76895_4832_9ca3_9e81_e0cdf028c09c["index.js"] 30d76895_4832_9ca3_9e81_e0cdf028c09c --> 3a02e121_a575_f687_567f_39a3a9f90904 style 3a02e121_a575_f687_567f_39a3a9f90904 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 type {ReactContext} from 'shared/ReactTypes';
import * as React from 'react';
import {
createContext,
Component,
forwardRef,
Fragment,
memo,
useCallback,
useDebugValue,
useEffect,
useReducer,
useState,
} from 'react';
const initialData = {foo: 'FOO', bar: 'BAR'};
// $FlowFixMe[missing-local-annot]
function reducer(state, action: {type: string}) {
switch (action.type) {
case 'swap':
return {foo: state.bar, bar: state.foo};
default:
throw new Error();
}
}
type StatefulFunctionProps = {name: string};
function StatefulFunction({name}: StatefulFunctionProps) {
const [count, updateCount] = useState(0);
const debouncedCount = useDebounce(count, 1000);
const handleUpdateCountClick = useCallback(
() => updateCount(count + 1),
[count],
);
const [data, dispatch] = useReducer(reducer, initialData);
const handleUpdateReducerClick = useCallback(
() => dispatch({type: 'swap'}),
[],
);
return (
<ul>
<li>Name: {name}</li>
<li>
<button onClick={handleUpdateCountClick}>
Debounced count: {debouncedCount}
</button>
</li>
// ... (116 more lines)
Domain
Subdomains
Functions
Dependencies
- ReactTypes
- 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 2 function(s): StatefulFunction, reducer.
What does index.js depend on?
index.js imports 2 module(s): ReactTypes, 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/EditableProps/index.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shell/src/app/EditableProps).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free