Merge pull request #5154 from ibagov/onnodeschange-docstring-update
Fixed onNodesChange docstring in component-props.ts
This commit is contained in:
5
.changeset/curly-kangaroos-clap.md
Normal file
5
.changeset/curly-kangaroos-clap.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@xyflow/react': patch
|
||||
---
|
||||
|
||||
Improve `onNodesChange` docs
|
||||
@@ -156,14 +156,14 @@ export interface ReactFlowProps<NodeType extends Node = Node, EdgeType extends E
|
||||
* It is called on node drag, select, and move.
|
||||
* @example // Use NodesState hook to create edges and get onNodesChange handler
|
||||
* import ReactFlow, { useNodesState } from '@xyflow/react';
|
||||
* const [edges, setNodes, onNodesChange] = useNodesState(initialNodes);
|
||||
* const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
|
||||
*
|
||||
* return (<ReactFlow onNodeChange={onNodeChange} {...rest} />)
|
||||
* @example // Use helper function to update edge
|
||||
* @example // Use helper function to update node
|
||||
* import ReactFlow, { applyNodeChanges } from '@xyflow/react';
|
||||
*
|
||||
* const onNodeChange = useCallback(
|
||||
* (changes) => setNode((eds) => applyNodeChanges(changes, eds)),
|
||||
* (changes) => setNode((nds) => applyNodeChanges(changes, nds)),
|
||||
* [],
|
||||
* );
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user