javascript - React Router cannot read ToUpperCase of undefined... basic example -
i have correct dependencies installed (react , react-router here) , using basic example react router github page... cannot rid of error.
my react router @ 0.13.3 & react @ 0.13.3 well.
here's code, in jsx:
import "../css/master.scss"; import react 'react'; import { router, route, link } 'react-router'; const app = react.createclass({ render() { return ( <div> <h1>app</h1> <ul> <li> <link to="about">about</link> </li> </ul> {this.props.children} </div> ) } }) const = react.createclass({ render() { return <h3>about</h3> } }) const contact = react.createclass({ render() { return <h3>contact</h3> } }) const routes = { path: '/', component: app, childroutes: [ { path: 'about', component: }, { path: 'contact', component: contact }, ] } react.render(<router routes={routes} />, document.getelementbyid('app'));
i changed final statement match router.run() , rendered react components. didn't see in quick intro on react-router.
sorry stackoverflow v_v
import "../css/master.scss"; import react 'react'; import router, { route, link } 'react-router'; const app = react.createclass({ render() { return ( <div> <h1><link to="/">app</link></h1> <ul> <li><link to="about">about</link></li> <li><link to="contact">contact</link></li> </ul> {this.props.children} </div> ) } }) const = react.createclass({ render() { return <h3>about</h3> } }) const contact = react.createclass({ render() { return <h3>contact</h3> } }) const approutes = ( <route path="/" handler={app}> <route name="about" handler={about} /> <route name="contact" handler={contact} /> </route> ); router.run(approutes, router.hashlocation, (root) => { react.render(<root />, document.getelementbyid('app')); });
Comments
Post a Comment