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.。

阅读 2.3k
1 个回答

代码写错了:

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

不是childrenRoutes

推荐问题