create first app and install React
Open cmd
Create a folder for the projects
Cd projects
Use create-react-app
to install React. This command will install all the dependecies to run the React program.
npx create-react-app hello
npx
is the package runner used by npm to execute packages in place of a global install. It basically creates a temporary install of React so that with each new project you are using the most recent version of React (not whatever version was current when you performed the global install above). Using the NPX package runner to execute a package can also help reduce the pollution of installing lots of packages on your machine.
Now cd
into hello project folder
Run Hello project
Run the command npm start
npm start
This command will start up the Node.js server and launch a new browser window displaying your app. Use Ctrl + c to stop running the React app in command line.
Compiled successfully!
You can now view hello in the browser.
Local: http://localhost:3000
On Your Network: http://172.22.32.1:3000
Note that the development build is not optimized.
To create a production build, use npm run build.
webpack compiled successfully
Open the web browser, you can see the React hello page.