React Review

Posted by JGB on February 13, 2020

React is extremely popular at the moment. You do not have to look far to find a company currently using React, in the process of transitioning to React, or considering transitioning over to React. A lot of companies are making the switch from Angular over to React. Both are component based and open source. Angular is managed by Google and React by Facebook. Angular allows for bidirectional data binding while React is unidirectional. Angular utilizes Typescript versus React’s JavaScript. So, they are fairly similar. Why are so many companies making this shift? What makes React so great? Basically, it boils down to a few main reasons: faster performance, faster programming, unidirectional data flow, JSX, and it is popular.

What exactly is React? React.js is a JavaScript library (there is also React Native for mobile apps). Is is the V (View) in the MVC framework. It renders your views! React allows you to build a hierarchy of UI components. React is responsible for the rendering of UI components. It provides support for both frontend and server-side.

React’s virtual DOM is faster than the standard full refresh of a page. React only re-renders part of the page where the component changed instead of the entire page, so it is much faster. This means a better user experience. And a very ‘reactive’ application.

React is not only faster in terms of performance, but it is faster to program due to the component structure. React’s component structure also allows you to program faster with reusable components. The components are isolated from each other so you are able to make changes in one without it affecting another. Thus, producing easier to maintain and debug DRY code. With Redux, you can managed state in one central location which will make your program even easier to maintain and very quick to test with the Redux testing/debugging tools.

With React’s unidirectional data flow, you app is more stable. Data flow from the parent to the child and changes in the child elements will not cause unwanted changed in the parent element which could happen in Angular apps with bidirectional data flow.

React is easier to learn than Angular and and easy to write JSX. JSX is a combination of HTML and JavaScript and is it very intuitive. Basically, we are putting HTML into JavaScript. It is a much easier way to write and read React.createElement(). Which is exactly what is happening behind the scenes.

Last, because React is so popular, there are so many resources available for you to use as support. There are endless blogs and tutorials and videos to help you learn React or get a refresher on how to do one thing. It is still growing rapidly (versus Angular which is not on the decline but it is just not growing as quickly), so you know you will have the support and documentation to create a stable and performant application with React.

Are you ready to hop on the React train?!