What is React.js?

https://mrobeidat.github.io/reading-notes/


What is React.js?

React.js is an open-source JavaScript library that is used for building user interfaces specifically for single-page applications. It’s used for handling the view layer for web and mobile apps. React also allows us to create reusable UI components. React was first created by Jordan Walke, a software engineer working for Facebook. React first deployed on Facebook’s newsfeed in 2011 and on Instagram.com in 2012.

React allows developers to create large web applications that can change data, without reloading the page. The main purpose of React is to be fast, scalable, and simple. It works only on user interfaces in the application. This corresponds to the view in the MVC template. It can be used with a combination of other JavaScript libraries or frameworks, such as Angular JS in MVC.

What is Component?

Characteristics of Components:

  1. Reusability − Components are usually designed to be reused in different situations in different applications. However, some components may be designed for a specific task.

  2. Replaceable − Components may be freely substituted with other similar components.

  3. Not context specific − Components are designed to operate in different environments and contexts.

  4. Extensible − A component can be extended from existing components to provide new behavior.

  5. Independent − Components are designed to have minimal dependencies on other components.

Some Advantages of using components :

  1. Ease of deployment − As new compatible versions become available, it is easier to replace existing versions with no impact on the other components or the system as a whole.

  2. Reliability − The overall system reliability increases since the reliability of each individual component enhances the reliability of the whole system via reuse.

  3. Independent − Independency and flexible connectivity of components. Independent development of components by different group in parallel. Productivity for the software development and future software development.


What is “Props” and how to use it in React?

React is a component-based library which divides the UI into little reusable pieces. In some cases, those components need to communicate (send data to each other) and the way to pass data between components is by using props.

“Props” is a special keyword in React, which stands for properties and is being used for passing data from one component to another.

How to use Props in React ?

  1. Firstly, define an attribute and its value(data).
  2. Then pass it to child component(s) by using Props.
  3. Finally, render the Props Data.