Home / File/ error.invalid-hoisting-setstate.js — react Source File

error.invalid-hoisting-setstate.js — react Source File

Architecture documentation for error.invalid-hoisting-setstate.js, a javascript file in the react codebase. 2 imports, 0 dependents.

File javascript TestingUtilities Fixtures 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  b02e178d_1095_49a0_49e4_7b5929bb5ac9["error.invalid-hoisting-setstate.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  b02e178d_1095_49a0_49e4_7b5929bb5ac9 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  b02e178d_1095_49a0_49e4_7b5929bb5ac9 --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style b02e178d_1095_49a0_49e4_7b5929bb5ac9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// @enableNewMutationAliasingModel
import {useEffect, useState} from 'react';
import {Stringify} from 'shared-runtime';

function Foo() {
  /**
   * Previously, this lowered to
   * $1 = LoadContext capture setState
   * $2 = FunctionExpression deps=$1 context=setState
   *  [[ at this point, we freeze the `LoadContext setState` instruction, but it will never be referenced again ]]
   *
   * Now, this function expression directly references `setState`, which freezes
   * the source `DeclareContext HoistedConst setState`. Freezing source identifiers
   * (instead of the one level removed `LoadContext`) is more semantically correct
   * for everything *other* than hoisted context declarations.
   *
   * $2 = Function context=setState
   */
  useEffect(() => setState(2), []);

  const [state, setState] = useState(0);
  return <Stringify state={state} />;
}

export const FIXTURE_ENTRYPOINT = {
  fn: Foo,
  params: [{}],
  sequentialRenders: [{}, {}],
};

Subdomains

Functions

Dependencies

  • react
  • shared-runtime

Frequently Asked Questions

What does error.invalid-hoisting-setstate.js do?
error.invalid-hoisting-setstate.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 error.invalid-hoisting-setstate.js?
error.invalid-hoisting-setstate.js defines 1 function(s): Foo.
What does error.invalid-hoisting-setstate.js depend on?
error.invalid-hoisting-setstate.js imports 2 module(s): react, shared-runtime.
Where is error.invalid-hoisting-setstate.js in the architecture?
error.invalid-hoisting-setstate.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-hoisting-setstate.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