Home / File/ reactive-ref-param.tsx — react Source File

reactive-ref-param.tsx — react Source File

Architecture documentation for reactive-ref-param.tsx, a tsx file in the react codebase. 2 imports, 0 dependents.

File tsx TestingUtilities Fixtures 2 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  96e1d41c_b83a_c57c_452a_e2ecbef65d18["reactive-ref-param.tsx"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  96e1d41c_b83a_c57c_452a_e2ecbef65d18 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  96e1d41c_b83a_c57c_452a_e2ecbef65d18 --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style 96e1d41c_b83a_c57c_452a_e2ecbef65d18 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {useRef, forwardRef} from 'react';
import {Stringify} from 'shared-runtime';

/**
 * Fixture showing that Ref types may be reactive.
 * We should always take a dependency on ref values (the outer box) as
 * they may be reactive. Pruning should be done in
 * `pruneNonReactiveDependencies`
 */

function Parent({cond}) {
  const ref1 = useRef(1);
  const ref2 = useRef(2);
  const ref = cond ? ref1 : ref2;
  return <Child ref={ref} />;
}

function ChildImpl(_props, ref) {
  const cb = () => ref.current;
  return <Stringify cb={cb} shouldInvokeFns={true} />;
}

const Child = forwardRef(ChildImpl);

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

Subdomains

Dependencies

  • react
  • shared-runtime

Frequently Asked Questions

What does reactive-ref-param.tsx do?
reactive-ref-param.tsx is a source file in the react codebase, written in tsx. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in reactive-ref-param.tsx?
reactive-ref-param.tsx defines 2 function(s): ChildImpl, Parent.
What does reactive-ref-param.tsx depend on?
reactive-ref-param.tsx imports 2 module(s): react, shared-runtime.
Where is reactive-ref-param.tsx in the architecture?
reactive-ref-param.tsx is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactive-ref-param.tsx (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