Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJacob Kortbeek
10,929 PointsI get a "unexpected token 'import' " when I try tp import React in jsx
I've used npm to install react and in the main jsx file I have used the import from method to use react, but when i look in my chrome browser I get unexpected token import.
2 Answers
Michael Liendo
15,326 Pointsthe import statement isn't supported on the web yet: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
To include it, it needs to be transpiled with your other es6 code using something like babel: http://babeljs.io/docs/setup/#installation
jason chan
31,009 Pointsdelete the entire node_modules directory and npm install all the stuff again.
Michael Liendo
15,326 PointsHow would that help?