Home / File/ reactive-control-dependency-on-context-variable.js — react Source File

reactive-control-dependency-on-context-variable.js — react Source File

Architecture documentation for reactive-control-dependency-on-context-variable.js, a javascript file in the react codebase. 1 imports, 0 dependents.

File javascript TestingUtilities Fixtures 1 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  82aa3bf9_a829_2ae5_5431_c4e029b1274f["reactive-control-dependency-on-context-variable.js"]
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  82aa3bf9_a829_2ae5_5431_c4e029b1274f --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style 82aa3bf9_a829_2ae5_5431_c4e029b1274f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {identity} from 'shared-runtime';

function Component(props) {
  let x;
  // Reassign `x` based on a reactive value, but inside a function expression
  // to make it a context variable
  const f = () => {
    if (props.cond) {
      x = 1;
    } else {
      x = 2;
    }
  };
  // Pass `f` through a function to prevent IIFE inlining optimizations
  const f2 = identity(f);
  f2();

  // The values assigned to `x` are non-reactive, but the value of `x`
  // depends on the "control" value `props.cond` which is reactive.
  // Therefore x should be treated as reactive too.
  return [x];
}

export const FIXTURE_ENTRYPOINT = {
  fn: Component,
  params: [],
  sequentialRenders: [
    {cond: true},
    {cond: true},
    {cond: false},
    {cond: false},
    {cond: true},
    {cond: false},
    {cond: true},
    {cond: false},
  ],
};

Subdomains

Functions

Dependencies

  • shared-runtime

Frequently Asked Questions

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