DEV Community

Adrian Grimm
Adrian Grimm

Posted on

Learning React

This week at the VetsWhoCode cohort, we started learning React. One of our homework assignments? To create this post. A post in which we were tasked with describing our newly-acquired knowledge of this library. So I started where anyone else would:, where I found a post titled "Explain React.js Like I'm Five". The post can be found here.

A benefit of using React over vanilla Javascript is the ability to re-use components. Components are snippets of code used in various portions of the application. With React, these components are imported into multiple pages, allowing them to be re-used. Not only does this cut down on development time, but eliminates duplicate required if using vanilla Javascript. When building complex web applications, these components become very useful for maintaining the state of a page, and handling the way data is managed and passed down through elements. React uses these components to manage state; by using these components effectively, the data is passed down to each component. Effective state management is a key aspect of using React.

Another benefit of using React is the Virtual DOM. React is built for better DOM management, and calculates the necessary changes needed, and refreshes only what is needed. React uses reconciliation to build the web page in virtual memory. Updates are run, and only the necessary changes are rendered in the browser. React uses a diff to check what changes need to be made to the HTML DOM, and then compares the collected diffs to update only the parts of the DOM indicated by those diffs. In this way, the rendering process is faster, because React only has to change or update a small part of what could be a large DOM.

Top comments (0)