React is a user interface library that was developed at Facebook. React is written in different components and follows the principles of immutable data. It’s often used in enterprise applications, and it makes creating single page applications easier since they have a higher speed thanks to the virtual DOM. This means it writes to the browser DOM only when it is needed, instead of re-rendering an entire view when a change is made.
Virtual DOM
React creates an in-memory DOM where it only renders different parts of the DOM when a change occurs.
JSX
React utilizes JSX, which is a JavaScript extension syntax that allows you to quote HTML.
Babel
Babel is a transpiler that transpiles JavaScript code. It works for JSX as well as ES6 and beyond. Babel converts React’s JSX and ES6 to something the browser can use.
Components
React applications consist of a collection of components. Components are small user interface elements that display data as it changes over time. Used together, these components create entire user interfaces.
Component Lifecycle
Component lifecycles allow you to add libraries and load data at specific times. They also help improve the speed of an application, with lifecycle methods that you can override to run code a specific times in the process.
Mounting methods are called when an instance of a component is being created:
getInitialState()
componentWillMount()
componentDidMount()
Updating methods occur when a change happens to props or state:
componentWillReceiveProps()
shouldComponentUpdate()
componentWillUpdate()
render()
componentDidUpdate()
Unmounting methods are called when a component is being removed:
componentWillUnmount()