makeomatic/redux-connect

add react-router middleware

Open

#67 aperta il 7 set 2016

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)JavaScript (73 fork)batch import
enhancementhelp wanted

Metriche repository

Star
 (550 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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

Guida contributor