Last active
April 4, 2022 05:54
-
-
Save xiongemi/61b07078dc9ec82f02f4a1452d428514 to your computer and use it in GitHub Desktop.
mock store decorator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/storybook/mocks/store.tsx | |
import { | |
initialRootState, | |
RootState, | |
} from '@studio-ghibli-search-engine/store'; | |
import React from 'react'; | |
import { Provider as StoreProvider } from 'react-redux'; | |
import configureStore from 'redux-mock-store'; | |
export const StoreDecorator = (story) => { | |
const mockStore = configureStore<RootState>([]); | |
const store = mockStore(initialRootState); | |
return <StoreProvider store={store}>{story()}</StoreProvider>; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment