reactjs - React Router: Call component function on RouteHandler ref -


i'm trying call component function on child component routehandler.

var bar = react.createclass({   baz: function() {     console.log('something');   },   render: function() {     return <div />;   }, });  var foo = react.createclass({   baz: function() {     this.refs['ref'].baz();   },   render: function() {     return <routehandler ref="ref" />;   }, ); 

where routehandler bar this.refs['ref'].baz undefined.

see https://facebook.github.io/react/tips/expose-component-functions.html more information on component functions.

i don't believe react-router supports exposing component functions on routehandlers , current hacky workaround do:

this.refs['ref'].refs['__routehandler__'].baz(); 

see https://github.com/rackt/react-router/issues/1597


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -