猿问

react怎么一次渲染多个组件

react怎么一次渲染多个组件


湖上湖
浏览 1596回答 2
2回答

慕虎7371278

1、把组件import进来123import&nbsp;{&nbsp;MyComponent1&nbsp;}&nbsp;from&nbsp;'components/MyComponent1&nbsp;'import&nbsp;{&nbsp;MyComponent2&nbsp;}&nbsp;from&nbsp;'components/MyComponent2&nbsp;'import&nbsp;{&nbsp;MyComponent3&nbsp;}&nbsp;from&nbsp;'components/MyComponent3&nbsp;'2、render方法调用组件1234567render()&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<MyComponent1&nbsp;/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<MyComponent2&nbsp;&nbsp;/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<MyComponent3&nbsp;/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>}&nbsp;
随时随地看视频慕课网APP
我要回答