React JS - Folder Structure

  • node_modules/ : It contains all the Node Libraries.

  • package.json : It is the most important file. This file contains dependencies and scripts required for the project. We can check react current version inside this file. 

  • package-lock.json: It contains log of all packages.

  • src/ : This is the main folder of react project. All source code is written inside this folder.

  • index.js : This is entry point file. This file gets call when we run the project.

  • App.js : This is default component of react project.

  • reportWebVitals.js : For Measuring Performance.

  • public/ : It contains files not related to react project. It contains css, js, images files.

  • index.html : It is the main HTML file of our app that includes your React code and provides a context for React to render to. If you look at the html file you could see <div id="root"></div>. We call this a “root” DOM node because everything inside it will be managed by React DOM.
Note :
We never commit node_modules/ folder because this folder is very heavy. We can run the command npm install and node_modules/ folder gets automatically created.

INTERVIEW QUESTIONS :
  • What is difference between package.json & package-lock.json files?
    Answer :
    package.json contains general information while package-lock.json contains detailed log.

  • Which is the most important file in React Project?
    Answer : 
    package.json

  • What are the ways to check React Version?
    Answer :
    1) Open package.json file.
    2) Open Terminal and write the command : npm view react version

  • Which is the default component of React?
    Answer : 
    App.js

Comments