What is React?

Get a good understanding of Reactjs and how it works.

We'll cover the following

Declarative coding involves writing code that tells React what we want. React is responsible for taking our declared code and performing Document Object Model (DOM) manipulation on our code to display our user interface (UI).

React was developed by Facebook. It works as a view using a component-based system. React is very fast and efficient at updating the user interface because it only refreshes the component that has changed, not the entire UI page.

How does React work?

React creates a virtual DOM of the real DOM. The DOM is how the browser represents the UI. Direct manipulation of the DOM is expensive and slow. Using this virtual copy of the real DOM subverts this expense.

When elements are added to a UI, React creates a virtual DOM. If the state of an element changes, another virtual DOM is created to reflect the change. React compares the current virtual DOM with the previous one and updates the portion that has changed through a process called diffing.

Once the diffing process is done, React calculates how to update the real DOM. This is done by only changing and refreshing the portion of the UI that has changed.

Get hands-on with 1400+ tech skills courses.