Working on my first React project and kinda new to JS, I am struggling with a very basic issue. I wonder what is the best practice to debug this?
I did create my app with create-react-app and I don't succeed loading an external script. Surprisingly I didn't find any help online or in the doc so far, rather any mention of this being an issue.
At the bottom of public/index.html, if I write:
<script>
console.log('Hello World!');
</script>
=> the console display 'Hello World!', normal, all good!
But if instead I do:
<script type="text/babel" src="../src/js/helloworld.js"></script>
and the helloworld.js file just contains console.log('Hello World!');
=> the console doesn't display anything!
Apparently, type must be "text/babel" or I get a syntax error.
What am I doing wrong ?
My folder structure is:
my-app
├── README.md
├── node_modules
├── package.json
├── .gitignore
├── public
│ └── favicon.ico
│ └── index.html
│ └── manifest.json
└── src
└── App.css
└── App.js
└── App.test.js
└── index.css
└── index.js
└── logo.svg
└── js
└── helloworld.js