Memory History on React Redux Template #910

Closed
opened 2025-08-09 17:18:08 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @DanHarman on 3/23/2017

Hi,

I'm adding routerMiddleware from react-router-redux so that I can navigate within the app (wondering if this shouldn't just be in the template?).

However in doing so I'm somewhat confused by boot-server.tsx as whilst it doesimport createMemoryHistory from 'history/lib/createMemoryHistory'; it never creates or uses a memory history. Is this intentional?

The reason this came up is that to apply routerMiddleware, so I can send redux actions to navigate, I need to pass it in the history module in use, and what this for boot-server.tsx isn't apparent. Right now I've put my change into configureStore.ts but I think it's probably incorrect because it's currently binding to browserHistory for both entrypoints.

\\ configureStore.ts
...
    const createStoreWithMiddleware = compose(
        applyMiddleware(thunk),
        applyMiddleware(routerMiddleware(browserHistory)),
        devToolsExtension ? devToolsExtension() : f => f,
    )(createStore);
...
*Originally created by @DanHarman on 3/23/2017* Hi, I'm adding `routerMiddleware` from `react-router-redux` so that I can navigate within the app (wondering if this shouldn't just be in the template?). However in doing so I'm somewhat confused by `boot-server.tsx` as whilst it does`import createMemoryHistory from 'history/lib/createMemoryHistory';` it never creates or uses a memory history. Is this intentional? The reason this came up is that to apply `routerMiddleware`, so I can send redux actions to navigate, I need to pass it in the history module in use, and what this for `boot-server.tsx` isn't apparent. Right now I've put my change into `configureStore.ts` but I think it's probably incorrect because it's currently binding to `browserHistory` for both entrypoints. ``` \\ configureStore.ts ... const createStoreWithMiddleware = compose( applyMiddleware(thunk), applyMiddleware(routerMiddleware(browserHistory)), devToolsExtension ? devToolsExtension() : f => f, )(createStore); ... ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#910
No description provided.