Skip to content

Instantly share code, notes, and snippets.

@yanmendes
Created August 2, 2019 20:52
Show Gist options
  • Save yanmendes/8b2d5b22c6bc5dec41ca2cf4c7be76eb to your computer and use it in GitHub Desktop.
Save yanmendes/8b2d5b22c6bc5dec41ca2cf4c7be76eb to your computer and use it in GitHub Desktop.
const renderWithReduxAndRouter = (
routes,
{
initialState = {},
store = createStore(reducer, initialState, applyMiddleware(thunk))
} = {},
{
route = '/',
history = createMemoryHistory({ initialEntries: [route] })
} = {}
) => ({
...render(
<Provider store={store}>
<Router history={history}>
<Switch>{routes}</Switch>
</Router>
</Provider>
),
store,
history
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment