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.

On the developer side react has several tools which make development fast. Props, short for properties, and state are to react concepts used to hold information relating to the component. Props contain information sent by the parent component and are considered immutable. State contains “private” information for the component to use on its own. A react component is much like a JavaScript function and it allows you to split the user interface into re-usable pieces. These powerful tools of props, state, and components allow developers to build their applications and user interfaces quickly.

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.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.