Home / File/ repro-mutate-new-set-of-frozen-items-in-callback.js — react Source File

repro-mutate-new-set-of-frozen-items-in-callback.js — react Source File

Architecture documentation for repro-mutate-new-set-of-frozen-items-in-callback.js, a javascript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

// @enableNewMutationAliasingModel:true

export const App = () => {
  const [selected, setSelected] = useState(new Set<string>());
  const onSelectedChange = (value: string) => {
    const newSelected = new Set(selected);
    if (newSelected.has(value)) {
      // This should not count as a mutation of `selected`
      newSelected.delete(value);
    } else {
      // This should not count as a mutation of `selected`
      newSelected.add(value);
    }
    setSelected(newSelected);
  };

  return <Stringify selected={selected} onSelectedChange={onSelectedChange} />;
};

Subdomains

Functions

Frequently Asked Questions

What does repro-mutate-new-set-of-frozen-items-in-callback.js do?
repro-mutate-new-set-of-frozen-items-in-callback.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 repro-mutate-new-set-of-frozen-items-in-callback.js?
repro-mutate-new-set-of-frozen-items-in-callback.js defines 1 function(s): App.
Where is repro-mutate-new-set-of-frozen-items-in-callback.js in the architecture?
repro-mutate-new-set-of-frozen-items-in-callback.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-mutate-new-set-of-frozen-items-in-callback.js (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability).

Analyze Your Own Codebase

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

Try Supermodel Free