React - expressions must have one parent element?

后端 未结 7 1429
再見小時候
再見小時候 2020-11-30 02:02

I\'m relatively new to React and I\'m wondering what\'s the standard here.

Imagine I have a react-router like this one:



        
7条回答
  •  抹茶落季
    2020-11-30 03:08

    2020 update

    I have checked out every solution from answers. Here is the breakdown for regular React:

    1. React Fragment

    When i wanted to use it once, without adding additional DOM node - it worked. When i tried to use second React.Fragment got really bad errors. Wasn't able to fix it.

    2. View

    I was unable to import View properly. I don't know if this is only for Reactjs, or Native, but this does not work

    3. Div

    What actually worked was to put HTML into Div

提交回复
热议问题