How to update URL in redux simple router from action? -


according redux simple router docs, can update route action. don't see how in documentation. have example of this?

you can import history singleton passed root component action , operate on directly, or, if you've installed router middleware, can use action creators provided react-router-redux.

from docs:

what if want issue navigation events via redux actions?

react router provides singleton versions of history (browserhistory , hashhistory) can import , use anywhere in application. however, if prefer redux style actions, library provides set of action creators , middleware capture them , redirect them history instance.

import { routermiddleware, push } 'react-router-redux'  // apply middleware store const middleware = routermiddleware(browserhistory) const store = createstore(   reducers,   applymiddleware(middleware) )  // dispatch anywhere normal. store.dispatch(push('/foo')) 

the following actions supported:

push(location) replace(location) go(number) goback() goforward()


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -