useVueFlowStore()
The useVueFlowStore composable returns the raw reactive state of the flow. Where
useVueFlow() gives you a curated set of
actions and getters, useVueFlowStore gives you the underlying reactive fields directly —
nodes, edges, transform, nodeLookup, connectionLookup, and so on. Read
them straight off the returned object (no .value), the same way you’d read a Pinia
store.
<script setup lang="ts">
import { useVueFlowStore } from '@xyflow/vue';
const store = useVueFlowStore();
// read reactive state directly
console.log(store.transform, store.nodeLookup.size);
</script>Signature
Parameters:This function does not accept any parameters.
Returns:Notes
- Prefer
useVueFlow()for most work — reach foruseVueFlowStoreonly when you need a raw store field that isn’t exposed as a getter. - To destructure value fields into refs without losing reactivity, pass the store
through
storeToRefs(). The map-like lookups (nodeLookup,edgeLookup,parentLookup,connectionLookup) can be destructured directly. - Like the other composables,
useVueFlowStorethrows when used outside a flow provider.