React Router only recognises index route

后端 未结 2 916
感情败类
感情败类 2021-01-07 04:19

I have 2 routes, / and /about and i\'ve tested with several more. All routes only render the home component which is /.

When

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-07 04:49

    Since you've nested About under Home you need to render a component within your Home component in order for React Router to be able to display your route components.

    import {RouteHandler} from 'react-router';
    
    var Home = React.createClass({
        render() {
            return (
    this is the main component
    ); } });

提交回复
热议问题