F
findInTree
Finds the first node in a React element or fiber tree a predicate matches, searching only downward.
Start from an element, a fiber, or a class instance's _reactInternals.
function findInTree<T = any>(root: any, predicate: TreePredicate, options?: TreeSearchOptions): T | undefinedParameters
| Name | Type | Description |
|---|---|---|
| root | any | The element or fiber to start from; it is tested too. |
| predicate | TreePredicate | Tests each non-nullish node. |
| options? | TreeSearchOptions |
|
Returns
T | undefinedThe first match, or undefined when none matches.