How to transfer this.state to react-routes?

By : batazor

I use the react-router and ES6, both in the new react-router to pass a value to the component? I used use <Handler name = {} /> now used {this.props.children}. How to transfer data to it from the App in the Components?

How to transfer this.state to react-routes with:

export default class App extends React.Component{

  constructor () {
    this.state = { name: 'Username' };

  render () {
    return (
        {this.props.children} // <-- this.state ???

  <Router history={HashHistory}>
    <Route path="" component={App}>
      <Route path="about" component={About} />
), document.getElementById('app'));

{this.props.children} // <-- this.state ???

By : batazor


I would recommend to access the information you store in App.state from separate Flux stores and then access them in each component you need. React router should not be involved into passing the data between routes.

This video can help you solving your question :)
By: admin