How to use Vuex through the setup function in Storybook

708 Views Asked by At

I am currently struggling with Vuex in Storybook. I use it through const store = useStore() in the setup function.

However I didn't find a way to inject a custom store into the component.

I can surely inject a store globally in the storybook preview.js config file as follow:

import { app } from '@storybook/vue3';
import store, { key } from '@/store';

app.use(store, key);

Is there a way to create custom stores for stories of components that are using the composition API (useStore() to get to Vuex) ?

0

There are 0 best solutions below