React

React is a JavaScript library. The 5 benefits of react is:

Shahibur Rahman
2 min readMay 7, 2021
  1. Easy to Learn, Easy to use.
  2. Reusable Components.
  3. Virtual DOM
  4. Great Developer Tools.
  5. Using JSX(mix of HTML & JavaScript)

Virtual DOM:

Virtual DOM is a node tree that lists elements and their attributes and content as objects and properties. React’s render() method creates a node tree from React components and updates this tree whenever it has changed. Updating the browser’s DOM is a three-step process in React.
1. Whenever anything may changed, the entire UI will be re-rendered.
2. The difference between from previous Virtual DOM will be calculated.
3. The real DOM will be updated with actual changed.

JSX:

JSX is the mix of HTML and JavaScript. JSX let us add HTML to our JavaScript. JSX produces React “elements”. It has more benefits including prevent injection attacks. It makes coding easier.

Reusable Components:

React is based on Components. Each component has its own logic and controls and can be reused. It helps to make apps easier to develop and easier to maintain. This is a short description, but using components provides a large advantage in app development efforts.

defaultProps:

defaultProps is a property in React component used to set default values for the props argument. It will be changed if the prop property is passed.
example:
class CustomButton extends React.Components{
}
CustomButton.defaultProps = {
color:’blue’
};

PropTypes:

PropsTypes is a library that helps in minimizing the problem in React by checking the types passed in the props object against a specification what set beforehand and to raise a warning if the types passed don’t match the types expected.

State in React:

The State of a component is an object that holds some information that may change over the lifetime of the component. The state object is where store property values that belongs to the component. When the state object changes, the component re-renders.

Context in React:

React context allows to share information to any component, by storing it in a central place and allowing access to any component that requests it (usually pass data from parent to child via props).

Redux in React:

Redux is a predictable state container designed to help to write JavaScript apps that behave consistently across client, server, and native environments and are easy to test.

React Native:

React Native is an exciting framework that create robust mobile applications. It offers faster mobile development, and more efficient code sharing across iOS, Android, and the Web, without sacrificing the end user’s experience or application quality.

--

--