首页 > React-router JSX 写法的问题

React-router JSX 写法的问题

跟着demo做的,文件:

const routerConfig = [
    {
        path          : '/',
        component     : Main,
        childrenRoutes: [
            {path: 'about', component: About},
            {path: 'inbox', component: Inbox}
        ]
    },
    {
        path: '*',
        component: Not
    }
];

ReactDOM.render(
    <Router routes={routerConfig} history={browserHistory}/>,
    document.querySelector('#APP')
);

其他一切正常就是到/about和/inbox时会报404.。


代码写错了:

const routerConfig = [
    {
        path          : '/',
        component     : Main,
        childRoutes: [
            {path: 'about', component: About},
            {path: 'inbox', component: Inbox}
        ]
    },
    {
        path: '*',
        component: Not
    }
];

不是childrenRoutes

【热门文章】
【热门文章】