makeomatic/redux-connect

add react-router middleware

Open

#67 opened on Sep 7, 2016

View on GitHub
 (0 comments) (0 reactions) (0 assignees)JavaScript (550 stars) (73 forks)batch import
enhancementhelp wanted

Description

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)}
  />
);

Contributor guide