reactjs - React Router DefaultRoute Not Rendering -
i'm attempting configure react-router work app (it doesn't ton yet). i've attempted use configuration, defaultroute not ever render, base route.
var routes = ( <route path="/" handler={app}> <defaultroute handler={loginform} /> </route> ); router.run(routes, function(handler) { react.render(<handler />, document.body); })
there no error, loginform never gets rendered (although app does). loginform , app both exist (so should able rendered). misunderstanding way react-router/defaultroute supposed work?
according documentation, second parameter router.run
should location
object (either hash
or history
).
var routehandler = router.routehandler; var router = require('react-router'); var route = router.route; // declare our routes , hierarchy var routes = ( <route path="/" handler={app}> <defaultroute handler={home}/> <route path="about" handler={about}/> <route path="inbox" handler={inbox}/> </route> ); var app = react.createclass({ render () { return ( <div> <h1>app</h1> <routehandler/> </div> ) } }); router.run(routes, router.hashlocation, (root) => { react.render(<root/>, document.body); });
Comments
Post a Comment