ruby on rails - React-router: component undefined -


i've been running through react-router tutorial found here , i'm puzzled...

react-router doesn't recognise component.

(i'm using react.js rails)

enter image description here

here's code:

var defaultroute = reactrouter.defaultroute; var link = reactrouter.link; var route = reactrouter.route; var routehandler = reactrouter.routehandler;  var app = react.createclass({    getinitialstate: function () {     return {       showtags: false,       current_user: this.props.current_user     };   },    _handletoggletags: function() {     this.setstate({       showtags: !this.state.showtags     })   },   render: function () {     return <div>       <header         ontoggletags={ this._handletoggletags }         user={this.props.current_user}       />        <routehandler/>        <div id="images">           <imagebox/>       </div>     </div>;   } });  var routes = (   <route name="app" path="/" handler={app}>     <route name="tags" handler={tagsbox}/>   </route> );  reactrouter.run(routes, function (handler) {   react.render(<handler/>, document.body); }); 

if move tagsbox before app works, though nobody else seems doing this. missing?

if makes different, current structure of components is:

  • app.js.jsx
  • tags
    • _tags_box.js.jsx

in position seems best run router once scripts loaded.

try wrapping run method in code:

document.addeventlistener("domcontentloaded", function() {   reactrouter.run(routes, function (handler) {     react.render(<handler/>, document.body);   }); } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -