reactjs - React router url params not stored in props -


i have simple routes:

import foo './foo'; import bar './bar';  const routes = (     <reactrouter.route handler={app} path="/">         <reactrouter.route path="foo" handler={foo} />         <reactrouter.route path="foo/:bar" handler={bar} />     </reactrouter.route> ); 

and components:

const foo = react.createclass({ ... })  ...  const bar = react.createclass({     componentdidmount() {         console.log('props', this.props.params);     },     render() {         console.log(this.props.params);         return (             <div>bar component</div>         );     } });  export default bar; 

when navigate /foo foo component rendered. when navigate /foo/something bar component rendered props object empty. assuming should have this.props.params bar = something there. following http://rackt.github.io/react-router/#router overview , nested details route react-router not rendering no luck.

because you're using rr 0.12.4 try this:

const bar = react.createclass({     mixins: [ reactrouter.state ],     render() {         console.log(this.getparams().bar);         return (             <div>bar component</div>         );     } }); 

Comments