Skip to content

Instantly share code, notes, and snippets.

@xiongemi
Created April 4, 2022 05:53
Show Gist options
  • Save xiongemi/80f1ba589233001e2441f8e6e320930b to your computer and use it in GitHub Desktop.
Save xiongemi/80f1ba589233001e2441f8e6e320930b to your computer and use it in GitHub Desktop.
mock store with thunk middleware
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