React JavaScript, can anyone help?

Hey everyone, hope all is well.
I recently began using React, and I got the folder to open. However, after having the browser open in localhost3000, I can’t get anything in the browser anymore. It only shows me this, and with each folder, it just shows the text in VS code. Can anyone help? Thanks!

  1. Did you delete the public folder or change the HTML file inside it?

The HTML file should contain the element the code will be mounted to.

public/index.html

<div id="root"></div>

src/index.js

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);
  1. Did you use npm start to start the server from the root?

It is kind of hard to help without seeing the code. I would suggest you create a GitHub repo with it (docs).

I did change up the html for different tutorials, though I kept the public folder.
I don’t remember using npm start, I was able to create a folder with all the subfolders.
https://github.com/mastershifu24/helloworld

the link to the repo gives 404 error

And I don’t see helloworld repo in the list of your repositories

Did you start the server using Live Server extension for VS Code?

Live Server Demo VSCode

If you did, that’s not how you need to start React app.

https://www.youtube.com/watch?v=Ma6DRDIedVE

It’s most likely private repo.

Yea I’m making it public now, thank you for the headsup.
I don’t know why that is though, I’ll try to put the link in again.

Interesting…before I started using React, stuff would just show up in the browser. I made a brand new React folder, and now it just shows text in the browser or the default React app.
And yes, I shared via Live server.

Live Server is not made to understand React.
You should follow the React tutorial on YouTube or the official React docs.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.