React fragment shorthand failing to compile

前端 未结 3 933
渐次进展
渐次进展 2020-12-29 02:08

The project in question is using React-16.2.0 which has the capability to use Fragments and the Fragment shorthand.

https://reactjs.org/blog/2017/11/28/react-v16.2.0

3条回答
  •  爱一瞬间的悲伤
    2020-12-29 02:57

    You can use the poor man's fragment shorthand as a quick fix: [ , ]

    render(){
      return [
        
    foo
    ,
    bar
    ] }

    as array is totally a valid jsx element.

提交回复
热议问题