Shamaayil Ahmed

Shamaayil Ahmed

Setup React Application using Npm

Setup React Application using Npm

Subscribe to my newsletter and never miss my upcoming articles

Listen to this article

Here let's see what it takes to build your first react application.

Prerequisites

ReactJS being a client-side library we require a package manager for automating the installing, upgrading and configuring packages.

One can execute reactjs code directly into Node.js, as React DOM has components specifically designed to reduce line of code, and making server-side rendering ease.

Since NPM(node package manager) is the default JavaScript runtime for Node.js, we will use NPM as the primal for all automations.

Prerequisite being installing Node.js as well npm and you're all ready to move on. After installation check for the presence to thyself in your machine using:

node -v 
npm -v    /*both returns the version of same in your machine*/

Install React package using NPM

Starting off it's better to know some npm command basics.

npm init   //creates manifest (package.json) file
npm -i *package name*     //creates specified package locally
npm -i *package name* -g   //creates specified package globally

These prove to be handy commands for further automation purposes through CLI.

For reactJS the command reads:

npx create-react-app *nameofyourapplication

createreactapp.gif

Being a larger package takes time to install all dependencies to your machine, end of installation creates the file in the space specified in commandline.

Now open the file in your favorite code editor, in the integrated command line start the server using:

npm start    //provides the localhost address and a system address to live output

startdev.gif

Whoo hoo you've created a react application


Hope you all liked this post.

Share your thoughts in comments below and let me know any impression for this post.

 
Share this