React.js for Web Development24/4/2021 A Brief History of React.js Facebook created React.js in 2011 for their own use. As you know, Facebook is one of the biggest Social Networking websites in the world today. In 2012, Instagram also started using it, which is a subsidiary of Facebook. In 2013, Facebook made React.js open-sourced. Initially, the developer community rejected it because it used Markup and JavaScript in a single file. But as more people experimented with it, they started embracing the component-centric approach for separating concerns. In 2014, many large companies started using React.js in their production environments. In 2015, Facebook open-sourced React Native too. It is a library that allows us to create native mobile apps in Android and iOS using React.js. In 2016, with version 15, React.js started using Semantic Versioning. This also helped convey to the developer's community that React was more stable. Today, React.js is used by many Fortune 500 companies. Facebook has full-time React development staff. They regularly release bug fixes, enhancements, blog posts, and documentation. React is Flexible React is remarkably flexible. Once you have learned it, you can use it on a vast variety of platforms to build quality user interfaces. React is a library, NOT a framework. Its library approach has allowed React to evolve into such a remarkable tool. React was created with a single focus: to create components for web applications. A React component can be anything in your web application like a Button, Text, Label, or Grid. But as React's popularity is grown, its ecosystem has also grown to cover various use cases. You can generate a static site with React using tools like Gatsby. You can use React Native to build mobile apps. You can even create Desktop applications using a tool like Electron, which can run on mac and windows with React.js technology. You can use React in your existing apps too. React was designed keeping this in mind. You can change a small part of your existing application by using React, and if that change works, then you can start converting your whole application into React.js. Facebook used the same approach. React Has Great Performance The React team realized that JavaScript is fast, but updating the DOM makes it slow. React minimizes DOM changes. And it has figured out the most efficient and intelligent way to update DOM. Before React, most frameworks and libraries would update the DOM unintelligently to reflect a new state. This resulted in changes to a significant portion of the page. React monitors the values of each component's state with the Virtual DOM. When a component's state changes, React compares the existing DOM state with what the new DOM should look like. After that, it finds the least expensive way to update the DOM. This doesn't seem very easy, but React handles it very well behind the scenes. It has multiple benefits like avoiding layout trashing, which is when the browser has to re-calculate the position of everything when the DOM element changes. Also, since most applications are being used on mobile devices they need to be highly efficient. So, saving battery and CPU power is very important. React's simple programming model allows it to change state automatically when data gets updated. This happens in the memory, so it is speedy. React's library size is also tiny. It is less than 6kb (less than 3kb when gzipped). This is significantly smaller than its competitors. React is Easy to Test
React's design is very user friendly for testing. Traditional UI browser testing is a hassle to setup. On the other hand, you require very little or no configuration for testing in React. Traditional UI browser requires browsers for testing, but you can test React components quickly and easily using the node command-line. Traditional UI browser testing is slow. But command-line testing is fast, and you can run a considerable amount of test suites at a time. Traditional UI browser testing is often time consuming and challenging to maintain. React test can be written quickly using tools like Jest & Enzyme. There are wide variety of JavaScript testing frameworks available on the web that you can use to test React.js (since it's also a JavaScript library). Some popular testing frameworks are Mocha, Jasmine, Tape, QUnit, and AVA. Conclusion React is an excellent tool with which to create interactive applications for mobile, web, and other platforms.
1 Comment
AuthorAditya Narayan Sah ArchivesCategories |