我想将一组数组[AccountSettings, PlanSettings]
传递给我的SettingsLayout
。
如何使用react-router
的PlainRoute?
export default {
path: 'settings',
component: SettingsLayout,
childRoutes: [
{
path: 'account',
component: [AccountSettings, PlanSettings]
},
{
path: 'notifications',
component: NotificationSettings
}
]
}
答案 0 :(得分:0)
使用components
https://github.com/reactjs/react-router/blob/master/docs/API.md#components-1
并传递一个对象:
components: {AccountSettings, PlanSettings}
您甚至可以这样做:
components: { components: [ AccountSettings, PlanSettings ] }
但是我还没有尝试过......即使你可以,它似乎并不是非常有用。