forwardCurrentToHead() — react Function Reference
Architecture documentation for the forwardCurrentToHead() function in code-path-analyzer.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 9f2557e7_03e4_e785_ae54_43d9e4959750["forwardCurrentToHead()"] 09a1c78a_21af_9be8_1cc6_22cf0ceb9f8f["code-path-analyzer.js"] 9f2557e7_03e4_e785_ae54_43d9e4959750 -->|defined in| 09a1c78a_21af_9be8_1cc6_22cf0ceb9f8f 161c28ff_1683_8239_7d98_2beab93199f8["processCodePathToEnter()"] 161c28ff_1683_8239_7d98_2beab93199f8 -->|calls| 9f2557e7_03e4_e785_ae54_43d9e4959750 338ea3d9_740a_9da0_1ae5_e9582eab1f95["processCodePathToExit()"] 338ea3d9_740a_9da0_1ae5_e9582eab1f95 -->|calls| 9f2557e7_03e4_e785_ae54_43d9e4959750 style 9f2557e7_03e4_e785_ae54_43d9e4959750 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-analyzer.js lines 183–218
function forwardCurrentToHead(analyzer, node) {
const codePath = analyzer.codePath;
const state = CodePath.getState(codePath);
const currentSegments = state.currentSegments;
const headSegments = state.headSegments;
const end = Math.max(currentSegments.length, headSegments.length);
let i, currentSegment, headSegment;
// Fires leaving events.
for (i = 0; i < end; ++i) {
currentSegment = currentSegments[i];
headSegment = headSegments[i];
if (currentSegment !== headSegment && currentSegment) {
if (currentSegment.reachable) {
analyzer.emitter.emit('onCodePathSegmentEnd', currentSegment, node);
}
}
}
// Update state.
state.currentSegments = headSegments;
// Fires entering events.
for (i = 0; i < end; ++i) {
currentSegment = currentSegments[i];
headSegment = headSegments[i];
if (currentSegment !== headSegment && headSegment) {
CodePathSegment.markUsed(headSegment);
if (headSegment.reachable) {
analyzer.emitter.emit('onCodePathSegmentStart', headSegment, node);
}
}
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does forwardCurrentToHead() do?
forwardCurrentToHead() is a function in the react codebase, defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-analyzer.js.
Where is forwardCurrentToHead() defined?
forwardCurrentToHead() is defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-analyzer.js at line 183.
What calls forwardCurrentToHead()?
forwardCurrentToHead() is called by 2 function(s): processCodePathToEnter, processCodePathToExit.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free