參考Hook

useStore

在 GitHub 上的原始碼

此 hook 可用於存取 Svelte Flow 的內部 store。

此 hook 僅適用於進階使用案例。 只有在沒有其他方法可以存取內部狀態時才應使用它。 對於許多常見的使用案例,都有專用的 hook 可用,例如 useConnectionuseNodes 等。

<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>

簽名

#回傳
#Svelte Flow Store 屬性
SvelteFlowStore