Friday, 25 May 2018

What is Redux ?

1- Redux is one of the framework get used to maintain application state. It is a predictable state container for JavaScript applications and is used for the entire applications state management.

2- Applications developed with Redux are easy to test and can run in different environments showing consistent behaviour.

3- Redux is not only React specific library, Angular team also integrated Redux in Angualr6 using ng/Rx library.

Lifecycle methods of React component.

1- componentWillMount() – get called only once component initiated i.e. after constructure and right place to call setState in initial stage.

2- componentDidMount() – get called only once after component render first time.

3- componentWillReceiveProps() – Invoked as soon as the props are received from the parent class and before another render is called.

4- shouldComponentUpdate() – Returns true or false value based on certain conditions. If you want your component to update, return true else return false. By default, it returns false.

5- componentWillUpdate() – Called just before rendering takes place in the DOM.

6- componentDidUpdate() – Called immediately after rendering takes place.

7- componentWillUnmount() – get Called just before to component unmount from the DOM. It is used to unsubcribe the listner/event to avoid memory leak, etc.

Advantages of React.

1- Better application’s performance as compare to other technology as React has very less dependent on external library to build and run the React application.
2- Because of JSX, code’s readability increases.
3- React has very less API as compare to Angular2/Angular6 so it is easy to understand and can use external npm library as per need of application.
4- React is easy to integrate with other frameworks like Meteor, Angular, nw/JS or Electron to build desktop app, etc.

How React Js works ?

React uses the virtual DOM instead of the real DOM and whenever state value changes react detect the changes and update particular field with new value without page reload.
It uses server-side rendering and follows both uni-directional data flow as well as data binding.

What is diffing algorithm?

  React needs to use algorithms to find out how to efficiently update the UI to match the most recent tree. The diffing algorithms is genera...