useNodesData
Source on GitHub (opens in a new tab)
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']);
$: {
// nodeData changes whenever the data of the passed node ids get updated
console.log($nodeData);
}
</script>Signature
| Name | Type |
|---|---|
#Params | |
# nodeId | string | string[] |
#Returns | |
Readable<{ id: string, type:string, data: object} | { id: string, type:string, data: object}[]>A readable store with id, type and data object/s of passed node id/s. |
Notes
- Check the Computing Flows example to see how this hook can be used