【发布时间】:2018-12-19 11:52:26
【问题描述】:
我从这里使用 react-router-config 包:https://www.npmjs.com/package/react-router-config 用于我的项目。我创建了一个 Routes.js 文件,在其中设置了我的路由配置,它看起来像这样:
export default [
{
...App,
routes: [
{
...IndexPage,
path: '/',
exact: true
},
{
...CategoryPage,
path: '/computers'
},
{
...CategoryPage,
path: '/home'
},
{
...NotFoundPage
}
]
}
];
如您所见,我使用两个路径“/computers”和“/home”来加载相同的组件CategoryPage。我想知道是否可以在一个对象中传递多个路径来加载相同的组件,如下所示:
{
...CategoryPage,
path: ['/computers','/home']
}
【问题讨论】:
标签: reactjs react-router