What is React.js?
React is a library developed by Facebook and implemented by many to build their user interfaces. React is fast, both to build applications and for the user, is modular, which helps developers simplify their code, and is scalable.
React uses a virtual DOM in order for applications to respond quickly to user input. The virtual DOM is an interface between react and the users display. The virtual DOM can be updated piece by piece, allowing individual parts of the user interface to be updated without having to refresh the entire application.
Delving into react components, each component has a distinctive life cycle: Initial, GetDefaultProps, GetInitialState, ComponentWillMount, Render, and ComponentDidMount.
The initial state comes from the initial creation phase. GetDefaultProps and GetInitialState are used to get at the default properties from the component and the initial state from the application. ComponentWillMount is used just as the render method is executed and setting the state in this phase does not trigger re-rendering. The render method generates the component mark up and this is the time when the props and state are interpreted. ComponentDidMount is called as soon as the renter method has been executed and is the proper place for any DOM manipulations and interactions.
All of these react features, from the modularity and control information, to the speed and ability to refresh individual components you have a virtual DOM make react in excellent choice for building single page applications.