1

我正在使用react-router-redux

假设我已经定义url/go-here/${routeId}并且我有routeId,数据对象也为

 data = {
    one: 'one',
    two: 'two',
    three: 'three'
 }

使用调度,我正在路由到一个新页面,如下所示,

this.props.dispatch(routeAction.push(url));

导航到新页面后,我想访问数据对象,我该怎么做?

4

1 回答 1

0

您可以触发要data在商店中设置的操作。然后,您的新页面只需读取此属性即可获取此数据。做到这一点的一个好方法是connect(使用react-redux)您的接收组件和mapStateToProps.

于 2016-03-13T03:30:35.940 回答