Written by - Saksham Jain

Reactjs Installation


Steps to install and use reactjs are as follows :-

  • First we need to download and install nodejs and npm. Link to download nodejs
  • Now install nodejs it will automatically install npm.
  • Now open command prompt and write the following command to create new project: npm install -g create-react-app (this will install react globally in your pc).
  • create-react-app -version (this is to check is react installed successfully or not).
  • create-react-app <projectname> (this will create your first react app in the specified folder).
  • Now a new folder is created on the selected location. To run your first app write the following command on command prompt:
    • First go to the folder in the command prompt and write npm start to run your project.
    • It will return the link open that in your browser it will look like
  • Some other commands to run and build your app:
    • npm run build: Bundles the app into static files for production.
    • npm test: Starts the test runner.
    • npm run eject: Removes this tool and copies build dependencies, configuration files and scripts into the app directory. If you do this, you can’t go back!

Exploring React Folder

  1. gitignore:- It is used when we upload our project on github.
  2. Package.json :- It is used when we give our project to others to test, it downloads all the dependencies of our project into that pc. It mainly consists of the description of the project and its dependencies.
  3. Node-modules:- It contains the node module which is essential for our react app.
  4. Public : It mainly contains the index.html file which is the main and only page of our site.
  5. Src: It contains the main code of our app. It has index.js,index.css,app.js,app.css etc.which help in performing actions on the page.