04 File Structure - biswajitsundara/react GitHub Wiki
The basic react project has the below files & folder structures
- This is the file required for every
node jsproject. - It contains scripts & dependencies
- We will find two key dependencies here -
reactandreact-dom - Then under scripts we have -
strat,build,testetc - We have
eslintconfiguration which will highlight syntactical errors - The
browserslistspecifies which browsers should be supported for your frontend app
- This is automatically generated when package.json is created/modified
- It contains the exact tree that was generated along with version name, subsequent dependencies etc.
- This file contains files/ folders those will not be tracked by git
- The standard read me file.
- Contains all the installed libraries
- The robots.txt, manifest.json files are meant for PWA (Progressive Web App)
-
index.htmlis the main file that gets served - Typically we will not change anything in this file.
- We will connect our components to root and then
<div id="root"></div>will do the rest.
- We will do all the work here during development.
-
index.jsrenders the<App>component to therootelement
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
- The app component comes from
App.jsfile - The app component is the view
-
App.cssis generated for styling &App.test.jsis for unit test -
index.csshas the stylings for the body. It's referred inindex.jsfile -
reportWebVitalsfor the performance testing -
setupTestsis to setup the tests.