insights | 20.09.2017

Benefits of using React for Web Applications.

React applications

React is a powerful JavaScript library which uses syntax called JSX, this allows you to mix both HTML and JavaScript. You can of course still write in plain JavaScript, however we do recommend trying the new syntax as it makes writing components very easy.

One of the best things about React is you can easily drop HTML into the render function, it then gets taken and converted into it’s own function using a JSX Transformer. This is great as a front end developer as it requires less code overall and allows you to write in HTML without having to use JavaScript to create the elements. React is also great as it use a Virtual DOM to manipulate a web page, which makes rendering the web application very quick.

Another thing about react is when it’s combined with build tools such as Gulp and Webpack it not only helps to keep your site compressed and clean but it has some great error reporting, this combined with the React chrome extension makes life debugging your web application very easy.

React also helps increase productivity as you can re-use components, this great in many scenarios, a common use could be something simple from a Modal, to something a bit more complex like a shopping basket.

State and Props

React gives you the ability to pass data to components in your web application, whether it’s used in the parent or in it’s children. This can be achieved with State and Props, they both do similar things but are used in different ways. Most of your components will probably be stateless.

Props are used to pass data from parent to child or to the components itself. They are immutable and cannot be changed. This is normally used to pass down things such as product data or general translations.

State is usually used for mutable data, or in short data that can be changed. This is great when it comes to user input. A good example of this could be a site search, a user will type and then the component would update what they see without reloading the page.

Main benefits and reasons to use React

  • It’s very efficient and fast – React creates it’s own virtual DOM, this has a massive advantage and brings great performance boost as it calculates all the changes that need to be made in the virtual DOM and then applies it to the DOM meaning you get a very fast rendering.
  • Use of Props and State – the ability to pass data and manipulate components without the user having to reload the page.
  • Development tools – React has a great chrome extension which makes debugging web applications very easy.
  • SEO – The main problem with many JavaScript frameworks is that they are not very search engine friendly. React overcomes this as it can be run on a server which allows the Virtual DOM to be rendered and returned to the browser as a webpage, this means it can be easily indexed.
  • React Native – As well as the react web framework it also has a native version, this means you can easily switch to making mobile applications as it follows the same design patterns making the transition easier

Check out the Xigen web development page to see our coding methods and how we use JavaScript.

go back Back