Things you need to know about reactjs

Rabin Poudyal
Mar 26 · 2 min read

React is a JavaScript library for building user interfaces. These interfaces are built using the concept of smaller components and their states. We can combine those components to build the application we want and we can also reuse them in future. React is built in Facebook and released in 2013.

It became very popular because it has smaller API to learn(Components, States, Props, JSX) to get strated and is less complicated than other alternatives, it is backed by Facebook and also it’s perfect timing of release because Angular 2 was released at that time and it had backward incompatibility.

React can also be used in legacy applications and slowly replace them because setting it up and using it is just matter of putting few script tags in html file and starting to build components.

What is different about react from other front-end frameworks and libraries?

React is just a view layer of MVC. Other frameworks and libraries like Angular and Ember.js implement MVC.

What libraries you need to start using react in your projects?

First, you need to import react and react-dom libraries to get started with it. React DOM is required because react is independent of browser and can be used in mobile apps and VR devices. So if we want to build browser based app we use it as a wrapper.

If we need to use JSX then we need another library known as Babel that will transpile modern JS to plain old JS.

What is create-react-app?

It is tool built for getting started using react without much hassle of setting up. Using this command line tool we can easily create a new react project with no hassle of setting of webpack or so. It does most of the things for us.

What is npx?

It is an easy way to download and execute Node.js commands without installing them. For example we can use npx to create a new react project by

npx create-react-app myproject

This will download latest create-react-app, create a new project and finally remove it from our system.

Few important commands:

npm run build: To build the project in build folder when we are ready to deploy

npm eject: To change configurations added by create-react-app. This will provide more flexibility in setting up babel and webpack. This action is irreversible.

npm test: To run test suite

If you like this post, don’t forget to clap the post and follow me on medium and on twitter.

Rabin Poudyal

Written by

Aspiring programmer. Say "hi" via email: rabinpoudyal1995@gmail.com or Follow me on twitter @poudyal_rabin

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade