Skip to Content
✨ Svelte Flow 1.0 is here! Rewritten for Svelte 5 with many new features and improvements.
ReferenceHooksuseNodes()

useNodes()

Source on GitHub 

This hook returns the current nodes array. When you subscribe, it will trigger whenever the nodes array changes. This happens when nodes are added, removed, or updated (dragged for example).

<script lang="ts"> import { useNodes } from '@xyflow/svelte'; const nodes = useNodes(); </script>

Signature

Parameters:

This function does not accept any parameters.

Returns:

A reactive signal of the current nodes

NameType
currentNode[]
update(updateFn: (nodes: Node[]) => Node[]) => void
set(nodes: Node[]) => void
Last updated on