I have created a React App that renders and h1 tag with "Hello World" to the browser. I have setup the App using CDN links rather than npm. The App has three files:
- index.html with one div tag with id of "root"
- App.js which renders my jsx to the div tag called root
- styles.css which I intent to use for some styles
Now the challenge is when I add import './styles.css'
at the top of my App.js, the App breaks and nothing appears on the browser. Upon inspecting the browser console I find the error message:
"App.js:1 Uncaught ReferenceError: require is not defined"-
Here is the screenshot of the error message from the browser console
My question is how do I import scripts/ other react components into my App.js without getting this error message? Why is babel giving me this error?
Here are the index.html, style.css and App.js codes:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…