Skip to Content
You are viewing the v1 docs of Svelte Flow. You can find the latest version here.
ReferenceHooks

useNodesData()

Source on GitHub 

With this hook you can receive the data of the passed node ids.

<script lang="ts"> import { useNodesData } from '@xyflow/svelte'; const nodeData = useNodesData(['node-id-a', 'node-id-b']); $effect(() => { // nodeData changes whenever the data of the passed node ids get updated console.log(nodeData.current); }); </script>

Signature

Parameters:
NameTypeDefault
nodeIdstring

The id (or ids) of the node to get the data from

Returns:

An array of data objects

NameType
currentDistributivePick<NodeType, "id" | "data" | "type"> | null

Notes

Last updated on