Home / File/ allow-ref-lazy-initialization-with-logical.js — react Source File

allow-ref-lazy-initialization-with-logical.js — react Source File

Architecture documentation for allow-ref-lazy-initialization-with-logical.js, a javascript file in the react codebase. 1 imports, 0 dependents.

File javascript TestingUtilities Fixtures 1 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  461cfd18_2e2d_53fa_c833_f869adb81e5d["allow-ref-lazy-initialization-with-logical.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  461cfd18_2e2d_53fa_c833_f869adb81e5d --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  style 461cfd18_2e2d_53fa_c833_f869adb81e5d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// @validateRefAccessDuringRender

import {useRef} from 'react';

function Component(props) {
  const ref = useRef(null);
  if (ref.current == null) {
    // the logical means the ref write is in a different block
    // from the if consequent. this tests that the "safe" blocks
    // extend up to the if's fallthrough
    ref.current = props.unknownKey ?? props.value;
  }
  return <Child ref={ref} />;
}

function Child({ref}) {
  'use no memo';
  return ref.current;
}

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

Subdomains

Functions

Dependencies

  • react

Frequently Asked Questions

What does allow-ref-lazy-initialization-with-logical.js do?
allow-ref-lazy-initialization-with-logical.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 allow-ref-lazy-initialization-with-logical.js?
allow-ref-lazy-initialization-with-logical.js defines 2 function(s): Child, Component.
What does allow-ref-lazy-initialization-with-logical.js depend on?
allow-ref-lazy-initialization-with-logical.js imports 1 module(s): react.
Where is allow-ref-lazy-initialization-with-logical.js in the architecture?
allow-ref-lazy-initialization-with-logical.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-ref-lazy-initialization-with-logical.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