usestate-derived-from-prop-no-show-in-data-flow-tree.js — react Source File
Architecture documentation for usestate-derived-from-prop-no-show-in-data-flow-tree.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
// @validateNoDerivedComputationsInEffects_exp @loggerTestOnly @outputMode:"lint"
function Component({prop}) {
const [s, setS] = useState();
const [second, setSecond] = useState(prop);
/*
* `second` is a source of state. It will inherit the value of `prop` in
* the first render, but after that it will no longer be updated when
* `prop` changes. So we shouldn't consider `second` as being derived from
* `prop`
*/
useEffect(() => {
setS(second);
}, [second]);
return <div>{s}</div>;
}
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does usestate-derived-from-prop-no-show-in-data-flow-tree.js do?
usestate-derived-from-prop-no-show-in-data-flow-tree.js is a source file in the react codebase, written in javascript. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in usestate-derived-from-prop-no-show-in-data-flow-tree.js?
usestate-derived-from-prop-no-show-in-data-flow-tree.js defines 1 function(s): Component.
Where is usestate-derived-from-prop-no-show-in-data-flow-tree.js in the architecture?
usestate-derived-from-prop-no-show-in-data-flow-tree.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/usestate-derived-from-prop-no-show-in-data-flow-tree.js (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free