You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 8, 2019. It is now read-only.
import{createStore,combineReducers,applyMiddleware}from'redux';import{routerMiddleware,push}from'react-router-redux'// Apply the middleware to the storeconstmiddleware=routerMiddleware(browserHistory)conststore=createStore(reducers,applyMiddleware(middleware))// Dispatch from anywhere like normal.store.dispatch(push('/foo'))
一个需求:比如新建文章,发送到服务器后,这时候页面应该有个跳转
PostAction.js
由于整个react组件的改变状态变化的权利都交给了redux,意味着所有必须在action层中完成跳转。
使用react-router-redux提供的api:
所以我的代码部分是这样的:
完美解决