ReferenceHooks

useStore

Source on GitHub

This hook can be used to access the internal store of the Svelte Flow.

This hook is only needed for advanced use cases. It should only be used if there is no other way to access the internal state. For many of the common use cases, there are dedicated hooks available such as useConnection, useNodes, etc.

<script lang="ts">
  import { useStore } from '@xyflow/svelte';
 
  // lots of props that you pass to the <SvelteFlow> component end up in the internal store.
  // Here we are accessing the current connectionMode.
  const { connectionMode } = useStore();
</script>

Signature

#Returns
#Svelte Flow Store props
SvelteFlowStore