React Router Redux go操作显示在LogMonitor中,但不会更改浏览器上的路径

rkm*_*max 6 reactjs redux

我在我的一个视图上使用react-redux-starter-kit我只是想重定向用户是没有设置somethig我的组件相当简单

// MyComponentWithRedirect.js
import React, {Component, PropTypes} from 'react'
import {connect} from 'react-redux'
import {go} from 'react-router-redux'

class MyComponentWithRedirect extends Component {
  static propTypes = {
    userInfo: PropTypes.object.isRequired,
    dispatch: PropTypes.func.isRequired
  }

  componentDidMount() {        
    if (this.props.userInfo.firstTime) {
      this.props.dispatch(go('/welcome'))
    }
  }
}

const mapStateToProps = (state) => ({userInfo: state.userInfo})

export default connect(mapStateToProps)(MyComponentWithRedirect)
Run Code Online (Sandbox Code Playgroud)

我可以看到LOCATION_CHANGE操作已触发,但未显示目标视图

在此输入图像描述

rkm*_*max 3

我发现我错过了syncHistoryWithStore的设置,之后它就像使用react-router API的魅力一样工作

import { browserHistory } from 'react-router'

...
browserHistory.push('/welcome')
Run Code Online (Sandbox Code Playgroud)

我不再需要派遣来改变地点