F

findComponent

Finds the first element in a rendered tree that a component name or predicate picks, walking only props and children.

function findComponent<P = any>(tree: any, match: ComponentMatch<P>): ReactElement<P, string | JSXElementConstructor<any>> | undefined

Parameters

NameTypeDescription
treeany

A render result, such as result in an after patch.

matchComponentMatch<P>

A component name, or a predicate on each element.

Returns

ReactElement<P, string | JSXElementConstructor<any>> | undefined

The first matching element, or undefined when none matches.