allow-ref-access-in-effect-indirect.js — react Source File
Architecture documentation for allow-ref-access-in-effect-indirect.js, a javascript file in the react codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 0137d8ac_e353_400f_f9ca_48845161567d["allow-ref-access-in-effect-indirect.js"] ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] 0137d8ac_e353_400f_f9ca_48845161567d --> ac587885_e294_a1e9_b13f_5e7b920fdb42 style 0137d8ac_e353_400f_f9ca_48845161567d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// @validateRefAccessDuringRender @validateNoSetStateInRender:false
import {useCallback, useEffect, useRef, useState} from 'react';
function Component() {
const ref = useRef(null);
const [state, setState] = useState(false);
const setRef = useCallback(() => {
ref.current = 'Ok';
}, []);
useEffect(() => {
setRef();
}, []);
useEffect(() => {
setState(true);
}, []);
// We use state to force a re-render and observe whether the
// ref updated. This lets us check that the effect actually ran
// and wasn't DCE'd
return <Child key={String(state)} ref={ref} />;
}
function Child({ref}) {
'use no memo';
// This violates the rules of React, so we access the ref in a child
// component
return ref.current;
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{}],
};
Domain
Subdomains
Functions
Dependencies
- react
Source
Frequently Asked Questions
What does allow-ref-access-in-effect-indirect.js do?
allow-ref-access-in-effect-indirect.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-access-in-effect-indirect.js?
allow-ref-access-in-effect-indirect.js defines 2 function(s): Child, Component.
What does allow-ref-access-in-effect-indirect.js depend on?
allow-ref-access-in-effect-indirect.js imports 1 module(s): react.
Where is allow-ref-access-in-effect-indirect.js in the architecture?
allow-ref-access-in-effect-indirect.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-ref-access-in-effect-indirect.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