相关疑难解决方法(0)

如何使用react-router-redux routeActions?

我正在尝试修改react-router-redux的示例代码. https://github.com/rackt/react-router-redux/blob/master/examples/basic/components/Home.js

这是我的Home.js

class Home extends Component {
    onSubmit(props) {
        this.props.routeActions.push('/foo');    
    }
}
Run Code Online (Sandbox Code Playgroud)

我也有一个mapDispatchToProps.

function mapDispatchToProps(dispatch){
    return bindActionCreators({ routeActions },dispatch);
}
Run Code Online (Sandbox Code Playgroud)

当我调用onSubmit函数时,我收到了一个错误

Uncaught TypeError: this.props.routeActions.push is not a function
Run Code Online (Sandbox Code Playgroud)

如果我在onSubmit中删除this.props,则URL中的键已更改,但它仍在同一页面上.从localhost:8080/#/?_k=iwio19localhost:8080/#/?_k=ldn1ew

谁知道怎么修它?欣赏它.

reactjs react-router react-router-redux

7
推荐指数
4
解决办法
1万
查看次数

标签 统计

react-router ×1

react-router-redux ×1

reactjs ×1