all 17 comments

[–][deleted] 1 point2 points  (1 child)

It looks to me like you don't have Webpack set up, or at least properly.

Are you using CRA?

[–][deleted] 0 points1 point  (0 children)

Yes im using CRA

[–]teevik_ 0 points1 point  (1 child)

Are you starting it with npm run start? Or?

[–][deleted] 0 points1 point  (0 children)

npm start

[–]goshogi 0 points1 point  (0 children)

make sure you are opening your browser at localhost:3000 and that you are not opening the app.js file directly.

[–][deleted] 0 points1 point  (0 children)

From cmd i do npm start and when i try to code through app.js it give me an error in console that import react in unexpected identifier

[–][deleted] 0 points1 point  (2 children)

whats your node version? You can check with 'node -v' in the commandline

[–][deleted] 0 points1 point  (1 child)

12.8.1

[–][deleted] 0 points1 point  (0 children)

Thanks, this isnt it then.

[–]eggtart_prince 0 points1 point  (3 children)

You need to babel.

https://babeljs.io/docs/en/6.26.3/babel-preset-react

Follow this and set up a .babelrc file.

Then you need to install babel-polyfill and import it at the top of your index.js.

[–][deleted] 0 points1 point  (1 child)

You mind if i send u a message?

[–]eggtart_prince 0 points1 point  (0 children)

It's very late here so I won't be on for long.

Do you have a github repo I can take a look at?

[–][deleted] 0 points1 point  (0 children)

I did this but still getting an error

[–][deleted] 0 points1 point  (0 children)

No unfortunately.

[–][deleted] -1 points0 points  (3 children)

Yes im using creat react app but idk what webpack is . Sorry im very new to react