04 File Structure - biswajitsundara/react GitHub Wiki

The basic react project has the below files & folder structures

Files

package.json

  • This is the file required for every node js project.
  • It contains scripts & dependencies
  • We will find two key dependencies here - react and react-dom
  • Then under scripts we have - strat, build, test etc
  • We have eslint configuration which will highlight syntactical errors
  • The browserslist specifies which browsers should be supported for your frontend app

package-lock.json

  • 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.

gitignore

  • This file contains files/ folders those will not be tracked by git

Readme.md

  • The standard read me file.

Folders

Node Modules

  • Contains all the installed libraries

Public

  • The robots.txt, manifest.json files are meant for PWA (Progressive Web App)
  • index.html is 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.

src

  • We will do all the work here during development.
  • index.js renders the <App> component to the root element
ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);
  • The app component comes from App.js file
  • The app component is the view
  • App.css is generated for styling & App.test.js is for unit test
  • index.css has the stylings for the body. It's referred in index.js file
  • reportWebVitals for the performance testing
  • setupTests is to setup the tests.
⚠️ **GitHub.com Fallback** ⚠️