javascript - Parse Error: Line 1: Illegal import declaration -
i created react application code in file called app.jsx
starts this:
import react, { component } 'react'; import logo './logo.svg'; import reactdom 'react-dom'; import './app.css';
when npm run
get:
> 1 | parse error: line 1: illegal import declaration | ^ 2 | file /path/to/file/app.jsx
i looked online , appears import
statement not recognised unless use babel.
however, understand, new create react app https://facebook.github.io/react/blog/2016/07/22/create-apps-with-no-configuration.html there no need babel.
so what's best way of solving issue?
you don't need add babel project because included in development environment provided create-react-app. however, can't run files directly. have use suggested in blog post linked in question.
Comments
Post a Comment