Component() — react Function Reference
Architecture documentation for the Component() function in effect-with-cleanup-function-depending-on-derived-computation-value.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 26aa5b47_9be9_f170_6e3c_fc0ec1125f4a["Component()"] f6aaba4d_2df6_7316_dbb4_0392b9d8e47a["effect-with-cleanup-function-depending-on-derived-computation-value.js"] 26aa5b47_9be9_f170_6e3c_fc0ec1125f4a -->|defined in| f6aaba4d_2df6_7316_dbb4_0392b9d8e47a style 26aa5b47_9be9_f170_6e3c_fc0ec1125f4a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/effect-with-cleanup-function-depending-on-derived-computation-value.js lines 5–21
function Component(file: File) {
const [imageUrl, setImageUrl] = useState(null);
/*
* Cleaning up the variable or a source of the variable used to setState
* inside the effect communicates that we always need to clean up something
* which is a valid use case for useEffect. In which case we want to
* avoid an throwing
*/
useEffect(() => {
const imageUrlPrepared = URL.createObjectURL(file);
setImageUrl(imageUrlPrepared);
return () => URL.revokeObjectURL(imageUrlPrepared);
}, [file]);
return <Image src={imageUrl} xstyle={styles.imageSizeLimits} />;
}
Domain
Subdomains
Source
Frequently Asked Questions
What does Component() do?
Component() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/effect-with-cleanup-function-depending-on-derived-computation-value.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/effect-with-cleanup-function-depending-on-derived-computation-value.js at line 5.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free