am currently trying to understand React Javascript but facing some problems after installing and enabling a React environment. Before installing node js and enabling the environment using “create-react-app”, I typed javascript code in react by using cdn links included in a script tag. This was pretty simple since I was able to go along with it with ease. However, when I installed a react environment, I have encountered problems understanding how it works since I dont have to type code in my html file and I also have problems loading it in a web page. Another problem is that I only have to write code in the App.js and index.js file not how I used to with vanilla javascript. When I use liveserver, the code I write in my javascript files does not load. How can I understand React better? I’d appreciate to know.
I tried using ReactDOM.render() but I received an error saying render is not a function, after I imported a function. I tried to run my code by running “npm start” but the web page did not open whenever I restarted my vs code. I tried using live server but it only loaded code in my html only. I thought maybe I should link the javascript files again but it didn’t work. So, generally my problem is with how the files are linked together in react, how they should be exported and imported, what I should do with html files and link them with other files, and the importance of the files that are created in the public folder and src folder.
You cannot use live-server with react. Unlike live-server
npm start
doesn’t automatically open a new window, you have to open a browser and input the localhost address manually – ex:http://localhost:3000
– beware that your port might be different