react怎么一次渲染多個組件
1 回答

繁花如伊
TA貢獻2012條經驗 獲得超12個贊
1、把組件import進來
1 2 3 | import { MyComponent1 } from 'components/MyComponent1 ' import { MyComponent2 } from 'components/MyComponent2 ' import { MyComponent3 } from 'components/MyComponent3 ' |
2、render方法調用組件
1 2 3 4 5 6 7 | render() { <div> <MyComponent1 /> <MyComponent2 /> <MyComponent3 /> </div> } |
添加回答
舉報
0/150
提交
取消