score:0

this code is from react-router issue #410 by rpflorence:

/** @jsx react.dom */
var react = require('react');
var router = require('react-router');
var route = router.route;
var routes = router.routes;
var link = router.link;

var foo = react.createclass({  
  render: function() { 
    return (
      <div>
        <p>hello</p>
        <p>stuffid: {this.props.params.stuffid}</p>
        <ul>
          <li><link to="root">top</link></li>
          <li><link to="stuff" params={{stuffid: 'one'}}>one</link></li>
          <li><link to="stuff" params={{stuffid: 'two'}}>two</link></li>
        </ul>
        <this.props.activeroutehandler />
      </div>
    );
  }
});

var routes = (
  <routes>
    <route name="root" path="/" handler={foo}>
      <route name="stuff" path=":stuffid" handler={foo}/>
    </route>
  </routes>
);

react.rendercomponent(routes, document.body);

Related Query

More Query from same tag