我在选择多个组件时遇到问题。
这项工作:
import * as ROUTES from '../../constants/Routes';
这个没有,我只想从路由中选择多个组件
import {comp1, comp2, comp3} as ROUTES from '../../constants/Routes';
我会将它们传递给下拉组件并映射()下拉组件中传递的ROUTES
const DROP_DOWN_LINKS = ROUTES;
<Dropdown links={DROP_DOWN_LINKS}/>
如何将这些称为import {comp1, comp2, comp3} as ROUTES from '../../constants/Routes';
的作品?
答案 0 :(得分:0)
import { Comp1, Comp2, Comp3 } from './mycomponent'
const arr = [Comp1, Comp2, Comp3]
arr.map(component => {
// ... do whatever you want
})