Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

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

Closed
pronevich opened this issue Sep 28, 2017 · 7 comments

Comments

@pronevich
Copy link

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

@hzoo
Copy link
Member

hzoo commented Sep 28, 2017

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.

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Sep 28, 2017

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 />
  ]
}

@loganfsmyth
Copy link
Member

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.

@pronevich
Copy link
Author

Thanks guys, I got it and reinstall modules solve issue

@AleCaste
Copy link

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!

@pronevich
Copy link
Author

@AleCaste maybe you miss comma between components in array?

@AleCaste
Copy link

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!!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants