【发布时间】:2018-01-02 02:59:49
【问题描述】:
我正在开发一个 React 项目,其中将提示用户一系列问题,这些问题的答案将组合为要保存的对象。
父组件包含多个子组件。
例如——
<Route path="Parent" component={Parent}>
<Route path="Child1" component={Child1} />
<Route path="Child2" component={Child2} />
<Route path="Child3" component={Child3} />
<IndexRoute component={Child1} />
</Route>
父级将具有空值的初始状态 前任。 (this.state={value1:"", value2:""})
在使用 {this.props.children} 时,如何将数据从子级传递给父级(以及从父级传递给子级的道具)?
【问题讨论】:
标签: reactjs react-router