Skip to content

Instantly share code, notes, and snippets.

@xiongemi
Last active April 4, 2022 05:54
Show Gist options
  • Save xiongemi/61b07078dc9ec82f02f4a1452d428514 to your computer and use it in GitHub Desktop.
Save xiongemi/61b07078dc9ec82f02f4a1452d428514 to your computer and use it in GitHub Desktop.
mock store decorator
// 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