F

filterInTree

Finds every 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 filterInTree<T = any>(root: any, predicate: TreePredicate, options?: TreeSearchOptions): T[]

Parameters

NameTypeDescription
rootany

The element or fiber to start from; it is tested too.

predicateTreePredicate

Tests each non-nullish node.

options?TreeSearchOptions

walkable adds keys to the React ones (such as return), ignore skips keys, maxDepth defaults to 100.

Returns

T[]

Every match, in visiting order.