6
我使用react-redux-starter-kit对我的看法我只是想将用户重定向是somethig没有设置我的一个组件不改变浏览器的路径是相当简单的阵营路由器Redux的去行动显示在LogMonitor但
// 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)
我可以看到触发LOCATION_CHANGE动作,但不显示目的地视图