useNodeGraph
useNodeGraph(
options?):UseNodeGraphReturn
Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:138
Own a node graph’s state (nodes / edges / groups / selection) plus the
mutations every editor re-implements — add / remove (with edge cascade) /
duplicate / connect / group. Spread bind onto <NodeGraph> and call the
actions from your toolbar / context menu:
const graph = useNodeGraph({ nodes: initialNodes, edges: initialEdges });return ( <NodeGraph {...graph.bind} renderNode={renderNode}> <NodeGraph.Background /> </NodeGraph>);// graph.addNode(...), graph.removeSelection(), graph.duplicateNodes(), ...Uncontrolled by design — the hook owns the state. For controlled state
(Redux / Zustand / external store) wire the four onChange props yourself.