Skip to Content
React Flow 13 is here! Read the announcement →
ReferenceTypes

NodesStore

Source on GitHub 

The nodes store is a slice of React Flow’s state returned by the useNodesStore() hook. Besides the nodes array it holds lookups of internal nodes by id and of child nodes by parent id.

import { useNodesStore, type NodesStore } from '@xyflow/react'; const nodeCountSelector = (state: NodesStore) => state.nodes.length; export function NodesInspector() { const count = useNodesStore(nodeCountSelector); return ( <div> <p>There are {count} total nodes</p> </div> ); }
NameTypeDefault
nodesNodeType[]
nodeLookupNodeLookup<InternalNode<NodeType>>
parentLookupParentLookup<InternalNode<NodeType>>
nodesInitializedboolean