useNode(id: string)
This hook returns the node with the specified ID. When you subscribe, it will trigger whenever
the node changes. This happens when the node is updated (dragged for example). The return value exposes a .current property to access the node.
<script lang="ts">
import { useNode } from '@xyflow/svelte';
const node = useNode('node-id');
$inspect(node.current);
</script>Signature
Parameters:| Name | Type | Default |
|---|---|---|
id | stringThe id of the node to get |
The current node inside a Svelte Flow context
| Name | Type |
|---|---|
current | NodeType | undefined |