[React Folder Working Directory] Do all the files/folders must be located in 'src' folder?

Hey guys, I’m trying to create the same project in the src folder for review.
So I created a new folder (src2), files and wrote the same code.
Hmm… But it doesn’t work with the src2 folder. (Ofc I uncommented the code in index.js file in src folder)

For the project in the src2 folder, it is supposed to appear “Hello World” in the browser, but it appears nothing.

So my question is

  1. Does React only work with the “src” folder??
  2. How to change the working directory from the “src” folder to the “src2” folder?

I hope you guys can understand my question / poor English…

Thx in advance :slight_smile:

@ryan.developer99 Yes, it is. It only works in src folder. Because, take a look at the index.js file in src folder. You will see these:
image

The index.js is the main rendering file for the react project. And it only imported the App.js file from the src folder and compile it with babel.
I think if you import the new file that you created, in index.js and render it instead of creating another index.js file.

Hope This Help

1 Like

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