Created
April 4, 2022 05:53
-
-
Save xiongemi/80f1ba589233001e2441f8e6e320930b to your computer and use it in GitHub Desktop.
mock store with thunk middleware
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
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'; | |
import thunk from 'redux-thunk'; | |
export const StoreDecorator = (story) => { | |
const mockStore = configureStore<RootState>([thunk]); | |
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