redux-connect icon indicating copy to clipboard operation
redux-connect copied to clipboard

add react-router middleware

Open GGAlanSmithee opened this issue 9 years ago • 0 comments

The README.md gives an example of how you can use this with applyRouterMiddleware. Would it make more sense to provide your own middleware instead? Might look something like:

const useReduxAsyncConnect = (helpers, filters) => ({
  renderRouterContext: (child, props) => (
    <ReduxAsyncConnect helpers={helpers} filters={filters} {...props}>{child}</ReduxAsyncConnect>
  )
})

and would be used like

const component = (
  <Router
    render={(props) => applyRouterMiddleware(useReduxConnect(helpers, filters), useScroll())}
    history={history}
    routes={getRoutes(store)}
  />
);

GGAlanSmithee avatar Sep 07 '16 13:09 GGAlanSmithee