effect-with-cleanup-function-depending-on-derived-computation-value.js — react Source File
Architecture documentation for effect-with-cleanup-function-depending-on-derived-computation-value.js, a javascript file in the react codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR f6aaba4d_2df6_7316_dbb4_0392b9d8e47a["effect-with-cleanup-function-depending-on-derived-computation-value.js"] ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] f6aaba4d_2df6_7316_dbb4_0392b9d8e47a --> ac587885_e294_a1e9_b13f_5e7b920fdb42 style f6aaba4d_2df6_7316_dbb4_0392b9d8e47a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// @validateNoDerivedComputationsInEffects_exp @loggerTestOnly @outputMode:"lint"
import {useEffect, useState} from 'react';
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
Functions
Dependencies
- react
Source
Frequently Asked Questions
What does effect-with-cleanup-function-depending-on-derived-computation-value.js do?
effect-with-cleanup-function-depending-on-derived-computation-value.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 effect-with-cleanup-function-depending-on-derived-computation-value.js?
effect-with-cleanup-function-depending-on-derived-computation-value.js defines 1 function(s): Component.
What does effect-with-cleanup-function-depending-on-derived-computation-value.js depend on?
effect-with-cleanup-function-depending-on-derived-computation-value.js imports 1 module(s): react.
Where is effect-with-cleanup-function-depending-on-derived-computation-value.js in the architecture?
effect-with-cleanup-function-depending-on-derived-computation-value.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/effect-with-cleanup-function-depending-on-derived-computation-value.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