Closed hung-phan closed 9 years ago
I run into this trouble today with react: 0.13.1, and react-router: 0.13.2. It can only render the DefaultRoute but not the 'test' Route. Did I do something wrong with this one?. I stuck with it for one hour and still counting.
react: 0.13.1, and react-router: 0.13.2
DefaultRoute
'test' Route
'use strict'; import React from 'react/addons'; import {Route, RouteHandler, DefaultRoute, HashLocation, run} from 'react-router'; import MainPage from './quiz/main-page'; import QuizDetails from './quiz/quiz-details'; import ResultPage from './quiz/result-page'; class Wrapper extends React.Component { render() { return ( <RouteHandler /> ); } } class Test1 extends React.Component { render() { return ( <div> <h1>Test 1</h1> </div> ); } } class Test2 extends React.Component { render() { return ( <div> <h1>Test 2</h1> </div> ); } } const routingComponent = document.getElementById('routing-component'); if (routingComponent) { let routes = <Route name='app' path='/' handler={Wrapper}> <Route name='test' handle={Test1} /> <DefaultRoute handler={Test2} /> </Route>; run(routes, HashLocation, (Handler) => { React.render(<Handler />, routingComponent); }); }
A typo, of course. handle must be handler
handle
handler
I run into this trouble today with
react: 0.13.1, and react-router: 0.13.2
. It can only render theDefaultRoute
but not the'test' Route
. Did I do something wrong with this one?. I stuck with it for one hour and still counting.