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

useNodesStore()

Source on GitHub 

import { useNodesStore, type NodesStore } from '@xyflow/react'; export function NodeLookup() { const nodeLookup = useNodesStore((state: NodesStore) => state.nodeLookup); return ( <div> <p>There are {Object.keys(nodeLookup).length} nodes in the flow.</p> </div> ); }

Signature

Parameters:

This function does not accept any parameters.

Returns:
NameType
nodesNode<Record<string, unknown>, string | undefined>[]
nodeLookupNodeLookup<InternalNode<Node<Record<string, unknown>, string | undefined>>>
parentLookupParentLookup<InternalNode<Node<Record<string, unknown>, string | undefined>>>
nodesInitializedboolean