Home / Function/ Foo() — react Function Reference

Foo() — react Function Reference

Architecture documentation for the Foo() function in hook-call-freezes-captured-memberexpr.tsx from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  0f1bd7d8_0d8c_a3ed_522d_7a3620e71d6a["Foo()"]
  3edc0944_d6de_1750_29a6_9a46ed116226["hook-call-freezes-captured-memberexpr.tsx"]
  0f1bd7d8_0d8c_a3ed_522d_7a3620e71d6a -->|defined in| 3edc0944_d6de_1750_29a6_9a46ed116226
  style 0f1bd7d8_0d8c_a3ed_522d_7a3620e71d6a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-call-freezes-captured-memberexpr.tsx lines 3–15

function Foo({val1}) {
  // `x={inner: val1}` should be able to be memoized
  const x = {inner: val1};

  // Any references to `x` after this hook call should be read-only
  const cb = useIdentity(() => x.inner);

  // With enableTransitivelyFreezeFunctionExpressions, it's invalid
  // to write to `x` after it's been frozen.
  // TODO: runtime validation for DX
  const copy = identity(x);
  return <Stringify copy={copy} cb={cb} shouldInvokeFns={true} />;
}

Subdomains

Frequently Asked Questions

What does Foo() do?
Foo() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-call-freezes-captured-memberexpr.tsx.
Where is Foo() defined?
Foo() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hook-call-freezes-captured-memberexpr.tsx at line 3.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free