mirror of
https://github.com/bendtherules/react-fiber-traverse.git
synced 2026-08-18 13:52:36 +00:00
Docs - Update built docs
This commit is contained in:
@@ -18,7 +18,21 @@
|
||||
|
||||
▸ **findNodeByComponent**(`node`: [FiberNode](_mocked_types_index_.md#fibernode) | null, `expectedClassOrFunction`: `React.ComponentType`): *[FiberNode](_mocked_types_index_.md#fibernode) | null*
|
||||
|
||||
*Defined in [findNode.ts:32](https://github.com/bendtherules/react-fiber-traverse/blob/18ea2e7/src/findNode.ts#L32)*
|
||||
*Defined in [findNode.ts:63](https://github.com/bendtherules/react-fiber-traverse/blob/21231fc/src/findNode.ts#L63)*
|
||||
|
||||
Find node by component (i.e. class or function by reference), till first match.
|
||||
|
||||
Matches against class and function by reference.
|
||||
Returns null if no match is found.
|
||||
|
||||
**`note`** Medium chance of collision, medium data access needed.
|
||||
This is safer than findNodeByComponentName, as different components with the same name won't collide.
|
||||
But, two instances of the same component will still collide.
|
||||
Needs access to component class or function.
|
||||
|
||||
**`example`**
|
||||
// returns FiberNode for first usage of AccordionMenu
|
||||
findNodeByComponent(startNode, AccordionMenu);
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -35,7 +49,20 @@ ___
|
||||
|
||||
▸ **findNodeByComponentName**(`node`: [FiberNode](_mocked_types_index_.md#fibernode) | null, `expectedName`: string): *[FiberNode](_mocked_types_index_.md#fibernode) | null*
|
||||
|
||||
*Defined in [findNode.ts:4](https://github.com/bendtherules/react-fiber-traverse/blob/18ea2e7/src/findNode.ts#L4)*
|
||||
*Defined in [findNode.ts:19](https://github.com/bendtherules/react-fiber-traverse/blob/21231fc/src/findNode.ts#L19)*
|
||||
|
||||
Find node by component name, till first match.
|
||||
|
||||
Matches against class and function name, doesn't match html-like nodes.
|
||||
Returns null if no match is found.
|
||||
|
||||
**`note`** Highest chance of collision, least data access needed.
|
||||
Different components with same name will collide.
|
||||
Needs access to component name.
|
||||
|
||||
**`example`**
|
||||
// returns FiberNode for first usage of 'AccordionMenu'
|
||||
findNodeByComponentName(startNode, "AccordionMenu");
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -52,7 +79,19 @@ ___
|
||||
|
||||
▸ **findNodeByComponentRef**(`node`: [FiberNode](_mocked_types_index_.md#fibernode) | null, `expectedClassInstance`: `Component`): *[FiberNode](_mocked_types_index_.md#fibernode) | null*
|
||||
|
||||
*Defined in [findNode.ts:63](https://github.com/bendtherules/react-fiber-traverse/blob/18ea2e7/src/findNode.ts#L63)*
|
||||
*Defined in [findNode.ts:108](https://github.com/bendtherules/react-fiber-traverse/blob/21231fc/src/findNode.ts#L108)*
|
||||
|
||||
Find node by component instance ref, till first match.
|
||||
|
||||
Matches against class instances by reference.
|
||||
Returns null if no match is found.
|
||||
|
||||
**`note`** Least chance of collision, maximum data access needed.
|
||||
Needs access to component instance (through React ref usually).
|
||||
|
||||
**`example`**
|
||||
// menuRef=createRef(); <AccordionMenu ref={menuRef}>
|
||||
findNodeByComponentRef(startNode, menuRef.current);
|
||||
|
||||
**Parameters:**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user