Component() — react Function Reference
Architecture documentation for the Component() function in repro-separate-memoization-due-to-callback-capturing.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 064e5cc5_5e7d_368a_caaa_a58365b87ffb["Component()"] 982013dc_2049_2b91_76b1_fee8459a5b03["repro-separate-memoization-due-to-callback-capturing.js"] 064e5cc5_5e7d_368a_caaa_a58365b87ffb -->|defined in| 982013dc_2049_2b91_76b1_fee8459a5b03 style 064e5cc5_5e7d_368a_caaa_a58365b87ffb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-separate-memoization-due-to-callback-capturing.js lines 11–39
function Component(a) {
let keys;
if (a) {
keys = Object.keys(Codes);
} else {
return null;
}
const options = keys.map(code => {
// In the old inference model, `keys` was assumed to be mutated bc
// this callback captures its input into its output, and the return
// is treated as a mutation since it's a function expression. The new
// model understands that `code` is captured but not mutated.
const country = Codes[code];
return {
name: country.name,
code,
};
});
return (
<>
<ValidateMemoization inputs={[]} output={keys} onlyCheckCompiled={true} />
<ValidateMemoization
inputs={[]}
output={options}
onlyCheckCompiled={true}
/>
</>
);
}
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/repro-separate-memoization-due-to-callback-capturing.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-separate-memoization-due-to-callback-capturing.js at line 11.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free