It has been a while that React has been around, but it was just last year that Facebook announced that it has built a library to build native apps using React ( read as Javascript ). Facebook decided to call this React Native.

There have been attempts at developing Javascript frameworks to build mobile apps, but I see React Native as a paradigm shift in the field. It is far far ahead as compared to other Javascript frameworks for building mobile apps in terms of performance. Having said that, the idea behind React Native was not building ‘write-once, run anywhere’ app but, more of ‘learn-once, write anywhere’ thing. For the sake of this article, let’s not categorize React Native with existing Hybrid Frameworks.

Having some free time lately, I found myself browsing the React Native docs and found it amazing. I would have been hugely disappointed in myself if I did not try this out.

Choosing the project

I did not have to think a lot on the kind of project to do in React Native. I did not want to write a server code for the app because the whole objective of the project was to learn React native and it would be an unnecessary burden on me writing a server. So options were clear —

  1. Write a client-only app. e.g. An alarm clock or the classic To-do app. I could not come up with something interesting in the category.
  2. Consume an API service and write a client. A Reddit client! Yes! That way I can use my app for browsing reddit and make incremental improvements to the app as well.

(Reddit API is quite straight forward and easy to grasp. Let us not go into its details as it would dilute the purpose of the article)

Setting Up

Setting up React Native was quite easy. You get the required libraries from npm, and that is it. Use your favorite editor/IDE and you are good to go. Personally, I would recommend using Atom by GitHub and installing the Nuclide package but people use vim or emacs with appropriate packages as well.

Learning Curve

I would say if you have a strong component-based programming experience, the learning curve would be much smoother. Otherwise, it might take you a while to grasp a few concepts but it should not be a tough nut to crack.

Experience

Oh la la! Writing JavaScript code and seeing it run in iOS emulator run as Native is impressive. What wizardry these guys have pulled off leaves you mesmerized.

Anyway, as my app began to grow I ran into a problem ( as is the case with developers ). In React, state is essentially the core of the application, which determines how each component behaves and renders. In my case, the state of the application was being changed from a lot of places and soon it was difficult to track from which modules of my app the state was being changed.

Meet Redux

Essentially a simplified Flow. It provides a framework to manage your state changes. It works on the principle of Action acting upon Current State, provides the Next State. React Native works coherently with the Redux Framework and solves much of your state change issues.

Overall Impression

To me, React Native does look like a strong contender for the future of mobile app development. What remains to be seen is how this affects the current mobile app dev platforms.

Google looks comfortable with its Java based Android SDK, although there was a rumour Google switching from Java to Swift after it’s lawsuit with Oracle ( which I find it unlikely in near future ). If that does happen, ‘learn once, write anywhere’ methodology is satisfied sans React Native with the perspective of a mobile apps.

And with Apple pushing its Swift language and rolling out updates, the stage looks set. What stands the test of time, remains to be seen.