Home / File/ error.todo-for-loop-with-context-variable-iterator.js — react Source File

error.todo-for-loop-with-context-variable-iterator.js — react Source File

Architecture documentation for error.todo-for-loop-with-context-variable-iterator.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
  b77240f4_0743_7e16_de34_e57b25e9f488["error.todo-for-loop-with-context-variable-iterator.js"]
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  b77240f4_0743_7e16_de34_e57b25e9f488 --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style b77240f4_0743_7e16_de34_e57b25e9f488 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {Stringify, useIdentity} from 'shared-runtime';

function Component() {
  const data = useIdentity(
    new Map([
      [0, 'value0'],
      [1, 'value1'],
    ])
  );
  const items = [];
  // NOTE: `i` is a context variable because it's reassigned and also referenced
  // within a closure, the `onClick` handler of each item
  // TODO: for loops create a unique environment on each iteration, which means
  // that if the iteration variable is only updated in the updater, the variable
  // is effectively const within the body and the "update" acts more like
  // a re-initialization than a reassignment.
  // Until we model this "new environment" semantic, we allow this case to error
  for (let i = MIN; i <= MAX; i += INCREMENT) {
    items.push(
      <Stringify key={i} onClick={() => data.get(i)} shouldInvokeFns={true} />
    );
  }
  return <>{items}</>;
}

const MIN = 0;
const MAX = 3;
const INCREMENT = 1;

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

Subdomains

Functions

Dependencies

  • shared-runtime

Frequently Asked Questions

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