babel / babylon

PSA: moved into babel/babel as @babel/parser -->

Home Page:https://github.com/babel/babel/tree/master/packages/babel-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React 16 SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag

pronevich opened this issue · comments

Question: maybe exists babylon beta that supports return array of elements in React 16 ?

commented

Hey @pronevich! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

Hi, can you fill the issue template which GitHub shows when you create a new issue?
Specifically, what is your input code? It should be something like this:

render() {
  return [
    <A />,
    <B />
  ]
}

Assuming you're talking about something like facebook/jsx#93, nothing is official yet, and the is no new syntax in Babel at this time. Using an actual array as mentioned above is the way to go.

Thanks guys, I got it and reinstall modules solve issue

Hi @pronevich , how did you fix the issue? I upgraded to React v16 and even though I am rendering an array with keys, I am still getting this error. I updated all babel modules and still getting the error!

@AleCaste maybe you miss comma between components in array?

Wowwwwwww!!!!.... That was exactly it! Silly stupid me.
I am sure others will make the same mistake; it's so easy to forget that especially if you are refactoring code for React v16
Thanks!!!