Category Archives: REACT

REACT FOR MOBILE APP

React For Mobile App

React_For_Mobile_App

React is a JavaScript library used for building user interfaces. Open-sourced by Facebook in 2013, it has been met with excitement from developers. Large companies such as Netflix, Yahoo!, GitHub, and Codecademy have included their likes. Users started praising React for its performance and flexibility, as-well-as its declarative, component-based approach for building user interfaces.

On January 2015, the React has announced a new project called React Native. React Native uses React to target the platforms other than web browsers, such as iOS and Android, by implementing a bridge between JavaScript and the host platform. It promises the web developers the ability to write real, natively rendering mobile applications, all from the comfort of JavaScript which the developers already know. How is it possible? And more importantly, how can one take advantage of it? In this article, we will be covering the basics of React Native and its importance for mobile apps.

How React Native works?

The idea of writing mobile applications in JavaScript feels little fluky. How is it possible to use React in a mobile environment? We will first need to recall one of the Reacts features, the Virtual DOM, and need to understand how it relates to React Native for mobile.

The Virtual DOM in React

In React, the virtual DOM acts as a layer between the developer’s description of things ought to look and work done actually to render them onto the page. To render interactive user interfaces in a browser, a developer must need to edit the browser’s Document Object Model(DOM). This process is a little bit expensive, and excessive writes to the DOM leads to the performance errors. Rather than directly rendering changes on the page, React computes the necessary changes by using an in-memory version of DOM.

Extending the Virtual DOM

The Virtual DOM certainly has performance benefits, but its real potential lies in the power of its abstraction. What if React could render to a target other than the browser DOM? Why should the React be limited to a browser? React “understands” how your application supposed to look like. The conversion of that ideal to actual HTML elements on the page should be replaced by some other step. During the first two years of React’s public existence, some spectators noticed this intriguing possibility. For an instance, Netflix modified React, so that they could render a huge variety of platforms including televisions and DVD players. Then at React conference, Facebook has announced a new library called React Native that does same for iOS and android, allowing React to render natively on mobile platforms.

What does it mean to render natively? In React for the web, this means it renders to browser DOM. With React Native, native rendering means, it renders using native APIs for creating views.

WHY USE REACT NATIVE?

One of the first thing people ask after learning React Native is, how it relates to standard, native platform development. How should the user make the decision of using React Native or not?

Whether to use React Native or not depends on the user individual circumstances and background knowledge. The developers who are comfortable working with JavaScript for the web, and React specifically, then React Native would be exciting. React Native can leverage your existing skillset to turn you into a mobile developer without requiring a significant investment on platform-specific languages and development paradigms. On the other hand, if you are already accustomed to traditional mobile development, then React Native’s advantages are less apparently. Let’s see some of the benefits and considerations of React Native.

BENEFITS

– At the beginning, Facebook only developed React Native to support iOS. However, with its recent support on Android operating system, the library can now render mobile UIs for both the platforms.

– If a developer knows JavaScript, then React Native is a quick pick-up, allowing any front-end developer to be a mobile developer on the spot. There is no need of learning iOS’s Swift or Java for Android.

You need to know JavaScript, some native UI elements, platform APIs, and any platform-specific design patterns, and you are ready to go-with-it.

React is still new but it’s maturing quickly and Facebook has stated its plans to continue investing its growth.

React Native is all about UI: React Native is focused completely on building a mobile UI. Compared to JavaScript frameworks like AngularJS or Meteor JS, React Native is UI-focused, making it JavaScript library than a framework.

- It offers third-party plugin compatibility and less memory usage: Third-party plugins means a user need not rely on a WebView for certain functions. For instance, if you are adding Google maps functionality to your app, React Native app let’s the user link the plug-in with a native module, so, the user can link-up the map with the device functions like zoom, rotate, and the compass by using less memory.