There are some prerequisites to set-up an environment for ReactJS. These are: NodeJS and NPM, React and React DOM, Webpack and Babel. To install ReactJS there are two ways: by using the npm command and by using the create-react-app command.
Using the create-react-app command:
The ‘create-react-app’ is a tool maintained by Facebook for beginners.
Install NodeJS and NPM.
Command: npm install -g create-react-app
Create a new React project.
Command: create-react-app project_name
Combine the two steps in a single command.
Command: npx create-react-app project_name
To get started, open the src folder and make changes in your desired file.
Start the server after the completion of the installation process.
- cd project_name
- npm start
The port number will be displayed. Open the port in the browser.