
Getting an error saying i cant use import regarding my front end code when im trying to run node index.... i havent had this issue till now when i just got back to this project.
I already have type": "module", insde my pacakage.json for my backend folder. im just a little confused why its giving me a syntax error in my backend console for code thats in my front end client folder I tried "type": "module", in my front ends package.json but then that causes issues with my front end code and wont run things.
Since react is written with JSX, you need to transpile the JSX into javascript. Trying to run a JSX file with node is going to result in an error because node will only run plain javascript. It may be a bit difficult to set up a transpiler like babel, so it is recommended that you use the create-react-app command in the terminal.
npx create-react-app nameofmy-app
and then to run the app:
npm start
This will start the build process, which will transpile your JSX into javascript, and then run a server that you can access in the browser.
After creating this new react app you will have to import your react files from your previous project directory.