DEV Community

Discussion on: Better file structure in React projects

Collapse
 
dmiku123 profile image
dmiku123

I am bit against not using src folder , I have my reasons and may be pretty much why it became a standard .
For example one of project I worked was originally written using knockout (since it was poc they had loosely written the code and not in a well maintained structure )as a POC . The POC became mainstream and then I joined as a react dev to migrate it to react . There comes the challenge identify all that is needed to be migrated , another challenge was we had choosen to implement typescript and did not want javascript file to be polluting the source but the typescript cannot be bundled directly without being converted . We were sharing some files with other team so had to generate the javascript version anyway to support AMD . And later we implemented microfrontend . So better wrap your source files . Also need to have a folder for your test files . If req a configuration file ,but its optional and depends on project requirement

Collapse
 
victorocna profile image
Victor Ocnarescu

I was not aware that having a src folder is a standard. If it is, I may reconsider using it. If not, I believe the file structure to be much cleaner without it.

Agreed on having a folder for test files. As long as it has the root folder as parent.