如何转移.State to reaction -routes
How to transfer this.state to react-routes?
我使用react-router和ES6,都在新的react-router中传递一个值给组件?我以前用的是<Handler name = {this.state.name} />
,现在用的是{this.props.children}
。如何将数据从组件中的应用程序传输到它?
如何传输这个。
export default class App extends React.Component{
constructor () {
this.state = { name: 'Username' };
}
render () {
return (
<div>
{this.props.children} // <-- this.state ???
</div>
);
}
};
React.render((
<Router history={HashHistory}>
<Route path="" component={App}>
<Route path="about" component={About} />
</Route>
</Router>
), document.getElementById('app'));
{this.props。//<——this。国家? ?
我建议从单独的Flux存储中访问存储在App.state中的信息,然后在需要的每个组件中访问它们。React路由器不应该参与到路由间的数据传递中。
相关文章:
- 节点Js:How to catch a“;没有这样的文件或目录“;读取线模块出错
- 混合 ui-sref 和 $state.go 在 Angular ui-router 中进行状态转换
- jQuery AJAX write to XML
- grep in JQuery to C#
- how to convert html <div> to pdf
- Node.js - POST to iFrame?
- SVG xml to image
- Advantages to DOMParser vs template & innerHTML
- how to split a string with ','
- How to declare a Map containing certain properties with flow
- Php variable obj to js
- 如何在submit to sightly时将表单输入值作为参数传递给WCMUsePojo
- D3JS selectAll to append rect
- Javascript connect to websocket
- 在$state.go之后执行$window.location.reload(true)
- Underscore each to update collection
- 在哪里可以找到R-to-JavaScript编译器
- 使用Angularjs$state.go导航
- Angular State Dropdown Bound to Country Select
- 如何转移.State to reaction -routes