question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`SyntaxError: Unexpected token` when encountering React Fragment shorthand syntax

See original GitHub issue
SyntaxError: Unexpected token (112:13)
    at Parser.pp$5.raise (./node_modules/babylon/lib/index.js:4454:13)
    at Parser.pp.unexpected (./node_modules/babylon/lib/index.js:1761:8)
    at Parser.pp$9.jsxParseIdentifier (./node_modules/babylon/lib/index.js:7029:10)
    at Parser.pp$9.jsxParseNamespacedName (./node_modules/babylon/lib/index.js:7040:19)
    at Parser.pp$9.jsxParseElementName (./node_modules/babylon/lib/index.js:7055:19)
    at Parser.pp$9.jsxParseOpeningElementAt (./node_modules/babylon/lib/index.js:7145:20)
    at Parser.pp$9.jsxParseElementAt (./node_modules/babylon/lib/index.js:7169:29)
    at Parser.pp$9.jsxParseElement (./node_modules/babylon/lib/index.js:7224:15)
    at Parser.parseExprAtom (./node_modules/babylon/lib/index.js:7236:21)
    at Parser.pp$3.parseExprSubscripts (./node_modules/babylon/lib/index.js:3494:19)

when it encounters Babel 7’s shorthand of React.Fragment, <>.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
the-simiancommented, Feb 5, 2019

(possibly duplicate of #79 )

1reaction
the-simiancommented, Aug 1, 2019

I updated the underlying parser, lets see if this is still an issue @luckykun

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fragments giving Unexpected token error in React 16.2
1 Answer 1 · @shubham Khatri You are life saver. – Nimmi Verma · 2. Exactly you right, new XML / JSX syntax...
Read more >
Compile error: I can't use "<>" and "</>" anymore? : r/reactjs
Syntax error : Unexpected token (95:21) ...which points to the first ... For reference I searched: "react fragment shorthand error". Upvote
Read more >
`SyntaxError: Unexpected token` when encountering React ...
SyntaxError : Unexpected token` when encountering React Fragment shorthand syntax.
Read more >
react unexpected token fragment
Bug Report Test suite failed to run Jest encountered an unexpected token This usually means that you are trying to import a file...
Read more >
Fragments giving Unexpected token error in React 16.2-Reactjs
As per the documentation, the syntax <></> is not supported by all tools and they encourage you to use <React.Fragment> instead.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found