Home / File/ inadvertent-mutability-readonly-lambda.js — react Source File

inadvertent-mutability-readonly-lambda.js — react Source File

Architecture documentation for inadvertent-mutability-readonly-lambda.js, a javascript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

function Component(props) {
  const [value, setValue] = useState(null);
  // NOTE: this lambda does not capture any mutable values (only the state setter)
  // and thus should be treated as readonly
  const onChange = e => setValue(value => value + e.target.value);

  useOtherHook();

  // x should be independently memoizeable, since foo(x, onChange) cannot modify onChange
  const x = {};
  foo(x, onChange);
  return x;
}

Subdomains

Functions

Frequently Asked Questions

What does inadvertent-mutability-readonly-lambda.js do?
inadvertent-mutability-readonly-lambda.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 inadvertent-mutability-readonly-lambda.js?
inadvertent-mutability-readonly-lambda.js defines 1 function(s): Component.
Where is inadvertent-mutability-readonly-lambda.js in the architecture?
inadvertent-mutability-readonly-lambda.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inadvertent-mutability-readonly-lambda.js (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler).

Analyze Your Own Codebase

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

Try Supermodel Free