5 July 2017

Build a Simple ReactJS application using react-cli

Hi All,

In this blog we will see how we can create a sample application using react-cli.  It is a command line interface tool that seeks to automate some tasks when working on a React.js project.

To starts with you have to install it globally by running following command:

npm install -g react-cli

The you have to run the following command in command window:

npm install -g create-react-app 

Now once it is installed you can create any directory where you want to create you sample ReactJS application.

I have created a folder with name "TestApp" in my local drive.

Now you have to run the following command to create the sample application.

create-react-app testapp 

While it is creating application and downloading all the artifacts related to this you can see the following things in command line as shown below:

So it will create a ReactJS application with name "testapp" under folder "TestApp" as you can see in the above screenshot.

Once the above step is completed you can see the following message in the command window as shown below:

if you check your application folder you can see the following artifacts has been created inside the project folder.

if you see inside the src folder, the following things it has been created automatically for you.

Now change your directory to testapp from TestApp by running the following command.

cd testapp

Now run the below command to start the npm server.

npm start

now once you open the following URL you can see your sample react application in your browser as shown below:

No comments:

Post a comment