index.js — react Source File
Architecture documentation for index.js, a javascript file in the react codebase. 10 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR a9cbaa5a_1a08_c395_56b8_61ce5609ff01["index.js"] b8ce5a14_1cf8_1044_56d2_6d19fb6e7b7b["context.js"] a9cbaa5a_1a08_c395_56b8_61ce5609ff01 --> b8ce5a14_1cf8_1044_56d2_6d19fb6e7b7b a2ae9415_2ed8_24e4_884e_2e4fd020acbe["LayoutViewer.js"] a9cbaa5a_1a08_c395_56b8_61ce5609ff01 --> a2ae9415_2ed8_24e4_884e_2e4fd020acbe 30857089_6b5e_f18c_6f47_4358eec5d021["LayoutViewer"] a9cbaa5a_1a08_c395_56b8_61ce5609ff01 --> 30857089_6b5e_f18c_6f47_4358eec5d021 a7173e0c_ba07_009a_1ada_f864062596b5["StyleEditor.js"] a9cbaa5a_1a08_c395_56b8_61ce5609ff01 --> a7173e0c_ba07_009a_1ada_f864062596b5 5bd6b860_acd1_7990_1d52_14fe72b2a7fb["StyleEditor"] a9cbaa5a_1a08_c395_56b8_61ce5609ff01 --> 5bd6b860_acd1_7990_1d52_14fe72b2a7fb 93f033b4_dafa_5e2c_c426_916dc940fc6b["index.css"] a9cbaa5a_1a08_c395_56b8_61ce5609ff01 --> 93f033b4_dafa_5e2c_c426_916dc940fc6b ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] a9cbaa5a_1a08_c395_56b8_61ce5609ff01 --> ac587885_e294_a1e9_b13f_5e7b920fdb42 7cd456b6_507e_98de_1e07_f65fc1623ee5["context"] a9cbaa5a_1a08_c395_56b8_61ce5609ff01 --> 7cd456b6_507e_98de_1e07_f65fc1623ee5 da8850dc_4f2e_2d41_9325_879cfbdd00b9["hooks"] a9cbaa5a_1a08_c395_56b8_61ce5609ff01 --> da8850dc_4f2e_2d41_9325_879cfbdd00b9 a185f695_5af9_82f0_a43a_ac143541224e["TreeContext"] a9cbaa5a_1a08_c395_56b8_61ce5609ff01 --> a185f695_5af9_82f0_a43a_ac143541224e d09ae4bb_9ed0_3257_c11b_1c199408288d["InspectedElementView.js"] d09ae4bb_9ed0_3257_c11b_1c199408288d --> a9cbaa5a_1a08_c395_56b8_61ce5609ff01 style a9cbaa5a_1a08_c395_56b8_61ce5609ff01 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 {useContext, useMemo} from 'react';
import {StoreContext} from 'react-devtools-shared/src/devtools/views/context';
import {useSubscription} from 'react-devtools-shared/src/devtools/views/hooks';
import {TreeStateContext} from 'react-devtools-shared/src/devtools/views/Components/TreeContext';
import {NativeStyleContext} from './context';
import LayoutViewer from './LayoutViewer';
import StyleEditor from './StyleEditor';
import styles from './index.css';
export default function NativeStyleEditorWrapper(): React.Node {
const store = useContext(StoreContext);
const subscription = useMemo(
() => ({
getCurrentValue: () => store.supportsNativeStyleEditor,
subscribe: (callback: Function) => {
store.addListener('supportsNativeStyleEditor', callback);
return () => {
store.removeListener('supportsNativeStyleEditor', callback);
};
},
}),
[store],
);
const supportsNativeStyleEditor = useSubscription<boolean>(subscription);
if (!supportsNativeStyleEditor) {
return null;
}
return <NativeStyleEditor />;
}
function NativeStyleEditor() {
const {inspectedElementID} = useContext(TreeStateContext);
const inspectedElementStyleAndLayout = useContext(NativeStyleContext);
if (inspectedElementID === null) {
return null;
}
if (inspectedElementStyleAndLayout === null) {
return null;
}
const {layout, style} = inspectedElementStyleAndLayout;
if (layout === null && style === null) {
return null;
}
return (
<div className={styles.Stack}>
{layout !== null && (
<LayoutViewer id={inspectedElementID} layout={layout} />
)}
{style !== null && <StyleEditor id={inspectedElementID} style={style} />}
</div>
);
}
Domain
Subdomains
Dependencies
- LayoutViewer
- LayoutViewer.js
- StyleEditor
- StyleEditor.js
- TreeContext
- context
- context.js
- hooks
- index.css
- react
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): NativeStyleEditor, NativeStyleEditorWrapper.
What does index.js depend on?
index.js imports 10 module(s): LayoutViewer, LayoutViewer.js, StyleEditor, StyleEditor.js, TreeContext, context, context.js, hooks, and 2 more.
What files import index.js?
index.js is imported by 1 file(s): InspectedElementView.js.
Where is index.js in the architecture?
index.js is located at packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/index.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free