isValidComponentParams() — react Function Reference
Architecture documentation for the isValidComponentParams() function in Program.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 6020b327_3c33_4f61_7c23_7f5e35e56457["isValidComponentParams()"] 9aa4477d_960b_1ea1_b6d9_36076aaa70bd["Program.ts"] 6020b327_3c33_4f61_7c23_7f5e35e56457 -->|defined in| 9aa4477d_960b_1ea1_b6d9_36076aaa70bd 2bfe28c2_c730_2f65_86db_f782c4b5a3e5["getComponentOrHookLike()"] 2bfe28c2_c730_2f65_86db_f782c4b5a3e5 -->|calls| 6020b327_3c33_4f61_7c23_7f5e35e56457 4653f7ad_06cf_fc52_32b4_0419d5483cef["isValidPropsAnnotation()"] 6020b327_3c33_4f61_7c23_7f5e35e56457 -->|calls| 4653f7ad_06cf_fc52_32b4_0419d5483cef style 6020b327_3c33_4f61_7c23_7f5e35e56457 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts lines 1151–1177
function isValidComponentParams(
params: Array<NodePath<t.Identifier | t.Pattern | t.RestElement>>,
): boolean {
if (params.length === 0) {
return true;
} else if (params.length > 0 && params.length <= 2) {
if (!isValidPropsAnnotation(params[0].node.typeAnnotation)) {
return false;
}
if (params.length === 1) {
return !params[0].isRestElement();
} else if (params[1].isIdentifier()) {
// check if second param might be a ref
const {name} = params[1].node;
return name.includes('ref') || name.includes('Ref');
} else {
/**
* Otherwise, avoid helper functions that take more than one argument.
* Helpers are _usually_ named with lowercase, but some code may
* violate this rule
*/
return false;
}
}
return false;
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does isValidComponentParams() do?
isValidComponentParams() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts.
Where is isValidComponentParams() defined?
isValidComponentParams() is defined in compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts at line 1151.
What does isValidComponentParams() call?
isValidComponentParams() calls 1 function(s): isValidPropsAnnotation.
What calls isValidComponentParams()?
isValidComponentParams() is called by 1 function(s): getComponentOrHookLike.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free