What Is React?
Before starting with React.JS, you should have be aware of below coding languages
First of all to create React App, you need NPM/yarn and Node.js installed on your system.
Refer https://www.npmjs.com/get-npm for installation
Setting up a React Environment:
Once NPM and Node.js is installed, you are ready to create a React Application.
Below are the steps to create app:
1. Install create-react-app by running the below command in your terminal:
npm install -g create-react-app my-app
This will create a folder named my-app and installs all the required files in it.
2. Go Browse through the src folder in the generated my-app folder and check all the files in it.
3. Once done run below command to execute the React application my-app:
This will open the default browser and pop up with your newly created React App!
If not, open your browser and type localhost:3000 in the address bar.
4. To update the content as per your requirements, Look in the my-app directory, and you will find a src folder.
Inside the src folder there is a file called App.js, open it and it will look like:
5. Try changing the html as per your need, and it will automatically reflect on your browser.
If there are any errors in your code it will be displayed on your terminal, on compilation.
6. In the case to upload the code on server, you need to build the app using following command
sudo npm run build
This will create a
build directory with a prod build of your app. Inside the
Note: You can run all the above NPM related cmd using yarn too if you have it installed on your system.