Component() — react Function Reference
Architecture documentation for the Component() function in error.todo-for-of-loop-with-context-variable-iterator.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 1439c71d_6366_c8c2_2386_7cccb6a6dbc5["Component()"] 66828905_1de6_f3e7_1fb4_09245a10bc20["error.todo-for-of-loop-with-context-variable-iterator.js"] 1439c71d_6366_c8c2_2386_7cccb6a6dbc5 -->|defined in| 66828905_1de6_f3e7_1fb4_09245a10bc20 style 1439c71d_6366_c8c2_2386_7cccb6a6dbc5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-for-of-loop-with-context-variable-iterator.js lines 3–17
function Component(props) {
const data = useHook();
const items = [];
// NOTE: `item` is a context variable because it's reassigned and also referenced
// within a closure, the `onClick` handler of each item
for (let item of props.data) {
item = item ?? {}; // reassignment to force a context variable
items.push(
<div key={item.id} onClick={() => data.set(item)}>
{item.id}
</div>
);
}
return <div>{items}</div>;
}
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/error.todo-for-of-loop-with-context-variable-iterator.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-for-of-loop-with-context-variable-iterator.js at line 3.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free