Gatsby: Support JSX fragment syntax

Created on 20 Dec 2017  路  4Comments  路  Source: gatsbyjs/gatsby

As of React 16.2 JSX fragments can use a <></> syntax instead of <Fragment></Fragment>. The latter syntax is supported in Gatsby, but the former is unsupported yet because it involves updating babel-preset-react.

Most helpful comment

Yeah, this will come along with our upgrade to Babel 7 in v2.

All 4 comments

Yeah, this will come along with our upgrade to Babel 7 in v2.

Is this still relevant? I'm having issues implementing the React.Fragment shorthand in v2.

Any updates on this ?
I cannot use React.Fragment
It gives me this error

React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.

Check your code at file.js:6.

Hey!

Shortcut for fragment works fine.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Oppenheimer1 picture Oppenheimer1  路  3Comments

dustinhorton picture dustinhorton  路  3Comments

rossPatton picture rossPatton  路  3Comments

brandonmp picture brandonmp  路  3Comments

timbrandin picture timbrandin  路  3Comments