useNodesData()
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:
Returns:
Name | Type | Default |
---|---|---|
nodeId | string The id (or ids) of the node to get the data from |
An array of data objects
Name | Type |
---|---|
current | Pick<NodeType, "id" | "data" | "type"> | null |
Notes
- Check the Computing Flows example to see how this hook can be used
Last updated on