index.js — react Source File
Architecture documentation for index.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
/**
* Exhaustive Deps
*/
// Valid because dependencies are declared correctly
function Comment({comment, commentSource}) {
const currentUserID = comment.viewer.id;
const environment = RelayEnvironment.forUser(currentUserID);
const commentID = nullthrows(comment.id);
useEffect(() => {
const subscription = SubscriptionCounter.subscribeOnce(
`StoreSubscription_${commentID}`,
() =>
StoreSubscription.subscribe(
environment,
{
comment_id: commentID,
},
currentUserID,
commentSource
)
);
return () => subscription.dispose();
}, [commentID, commentSource, currentUserID, environment]);
}
// Valid because no dependencies
function UseEffectWithNoDependencies() {
const local = {};
useEffect(() => {
console.log(local);
});
}
function UseEffectWithEmptyDependencies() {
useEffect(() => {
const local = {};
console.log(local);
}, []);
}
// OK because `props` wasn't defined.
function ComponentWithNoPropsDefined() {
useEffect(() => {
console.log(props.foo);
}, []);
}
// Valid because props are declared as a dependency
function ComponentWithPropsDeclaredAsDep({foo}) {
useEffect(() => {
console.log(foo.length);
console.log(foo.slice(0));
}, [foo]);
}
// Valid because individual props are declared as dependencies
function ComponentWithIndividualPropsDeclaredAsDeps(props) {
useEffect(() => {
console.log(props.foo);
console.log(props.bar);
}, [props.bar, props.foo]);
// ... (108 more lines)
Domain
Subdomains
Functions
- Comment()
- ComponentWithConditionalHook()
- ComponentWithIndividualPropsDeclaredAsDeps()
- ComponentWithNoPropsDefined()
- ComponentWithPropsDeclaredAsDep()
- ComponentWithoutDeclaringPropAsDep()
- InvalidComponentFactory()
- InvalidGlobals()
- InvalidUseMemo()
- UseEffectWithEmptyDependencies()
- UseEffectWithNoDependencies()
- normalFunctionWithConditionalFunction()
- useHook()
- useHook1()
- useHook2()
- useHookInLoops()
- whatever()
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, Optimization subdomain.
What functions are defined in index.js?
index.js defines 17 function(s): Comment, ComponentWithConditionalHook, ComponentWithIndividualPropsDeclaredAsDeps, ComponentWithNoPropsDefined, ComponentWithPropsDeclaredAsDep, ComponentWithoutDeclaringPropAsDep, InvalidComponentFactory, InvalidGlobals, InvalidUseMemo, UseEffectWithEmptyDependencies, and 7 more.
Where is index.js in the architecture?
index.js is located at fixtures/eslint-v8/index.js (domain: BabelCompiler, subdomain: Optimization, directory: fixtures/eslint-v8).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free