Home / File/ reactive-setState.js — react Source File

reactive-setState.js — react Source File

Architecture documentation for reactive-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
  e918d484_8ff1_a424_5824_f0dff5b3b9d2["reactive-setState.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  e918d484_8ff1_a424_5824_f0dff5b3b9d2 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  e918d484_8ff1_a424_5824_f0dff5b3b9d2 --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style e918d484_8ff1_a424_5824_f0dff5b3b9d2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

/*
 * setState types are not enough to determine to omit from deps. Must also take reactivity into account.
 */
function ReactiveRefInEffect(props) {
  const [_state1, setState1] = useRef('initial value');
  const [_state2, setState2] = useRef('initial value');
  let setState;
  if (props.foo) {
    setState = setState1;
  } else {
    setState = setState2;
  }
  useEffect(() => print(setState), AUTODEPS);
}

Subdomains

Dependencies

  • react
  • shared-runtime

Frequently Asked Questions

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