Blog

Sometimes we’ll have a few thoughts, and we’ll write them down over here.

Why YTEC develops apps with React Native

Before React Native, developing applications for mobile devices typically involved a lot of code duplication; Android applications are typically written in Java, whereas iPhone apps are written in Objective-C or Swift. This meant that the same code could not be reused on different platforms. An alternative was developing a website application—YTEC’s specialization—that would run in a browser on the device. However, currently it is difficult to achieve the same level of integration and ease of use with an application running in a browser as with a natively running app. Examples of limitations of browser-based apps are the lack of an application icon and limited support for gestures.

Besides taking more time to develop, having to maintain different application target platforms has an additional downside: programmers have to invest time to familiarize themselves with these different platforms and programming languages. YTEC continuously strives for as great a degree of overlap and redundancy between programmers’ skill sets as possible, because a skill which is mastered by only a single developer would compromise flexibility of planning. This is why YTEC is picky about which technologies are picked up and only embraces that which can be committed to company-wide.

Initially, we could not develop apps for Apple devices by ourselves, because we had limited experience with Swift and Objective-C. For iOS versions of our apps, we then had to hire external programmers, causing a longer lead time. – Ying Hao Ma, YTEC

YTEC is not alone in having to deal with these issues. When Facebook had to confront these same issues (during the development of their Ads Manager app), they made use of a homegrown solution: React Native, which allows you to write one application for the web (accessible by web browsers on all types of devices), and for iOS and Android, while utilizing a language already familiar to all web developers: Javascript. React Native will take this JavaScript code and convert it into Java or Objective-C.

React Native is derived from React, a JavaScript framework for so-called single page applications (SPAs) also developed by Facebook. An SPA is a single web page that retrieves data according to the location of the user on the page. The retrieved data is distributed over the components of the page. The components pass the data, which often comes from an API, along to other (child) components. Many complex web applications are SPAs. Well-known examples are Facebook, Gmail, and Twitter. You are often using them without necessarily noticing it, because it may look like you’re retrieving a new page by following a link while what really happens is that the SPA is changing the URL without ever loading a new page; meanwhile, data is being retrieved on the background to update elements in the page—components in React-speak.

As soon as React was mature enough for production use, encouraged by its large and expanding user base, YTEC started to adopt it for some new projects, like the website on which you’re reading this blog.

Development—especially the development of highly interactive web applications—is made easier by rolling all the user-interface logic into React components, which makes it easy to track state. (State is what has happened and how the application should respond; this has always been notoriously difficult to do well in web applications, because HTTP, the protocol over which web pages are transferred, is essentially stateless.) When a component’s state changes, all its child components are updated, and components can signal each other about changes as well. For simple web applications, this is not a huge time-saver compared to how fast and clean we were already delivering features by leveraging the excellent Django Python web development framework, but React Native’s ability to build multiple apps for different mobile platforms with a single code base should tip the balance towards this choice also for projects which are not very complex UI-wise, but which do require a native application

To sum up the advantages of React Native:

  • We can leverage our existing skill-sets to deliver mobile apps to our clients.
  • We can target multiple mobile platforms and the web simultaneously.
  • As a nice extra, React Native gives the developer is a debugger that reloads the code on autopilot after each change. A real time-saver, which is why, at YTEC, a similar ‘hot-reloading’ feature is also used for regular React work.
  • To the customer, this translates to: shorter development times and a smaller investment.

With React Native in our tool belt, YTEC has become a more reliable partner for the development of mobile apps.