Experimenting with React Native

Facundo Acosta

We humans are curious by nature. From the moment we are born we are learning everything about our surroundings, and continue to do so until our last days. First we learn how to crawl, then we learn how to walk and then run. We also learn a lot of things about maths, history, nature, and a vast list of stuff that I’m not going to mention because that’s not the point of this blog entry.

“Why are you telling me all this?” you may ask. Well, just when I thought I’d learnt everything I could about app development (How naive I was!), I discovered something new: React Native. And by discovered I mean that the guys here at GearedApp told me that I should use it for developing my mobile apps, and I was like “Hell yeah! Bring It on!”

And “What is React Native?”, you are probably asking yourself. Well, React Native is an open source development environment designed by the guys at Facebook that allows you to build mobile apps using JavaScript both for Android and iOS. As they say on their website: “Learn once, write anywhere”. Many apps use React Native, such as Facebook, Instagram, Discord, and the list is growing every day.

Until now I had been developing mobile apps natively using Java, so I was interested to see how using JavaScript to build cross-platform applications would turn out. I was aware I would have an initial hurdle in adjusting to coding in JavaScript, which was a challenge. But once you get used to it, there’s no looking back. Objective-C? Java? What are they?

         Heads-up, If you are used to working with IDE’s like NetBeans or Eclipse that constantly point out all your typos, you may struggle a little bit with React Native because you will have to use text editor like Sublime Text. But I have a really nice solution for that further down this article.

My experience so far with React Native has been really good. Well, obviously there are always the occasional bugs that take hours to fix, but that’s all part of ‘Developer Life’. So far every app I’ve built with React Native has worked as I expected, and for that reason I see it as a very powerful tool for developing mobile apps.

One of the coolest things about React Native is that you are able to create and share useful (or otherwise) components with other people. The community is growing and changing everyday, and there is always someone willing to help you if you have a question or problem. Just as an example, this week I was trying to fix a bug that I had with a component in one of my apps and I couldn’t find the error. I decided to open an issue on GitHub, and an hour later I had an answer from someone telling how to resolve the issue. To me this demonstrates a constantly evolving and friendly React community.

As the React Native community grows, so does the number of components that people create and contribute. Now, as a little summary, here is a list the components that I think that are a must-have. Obviously, there are a ton of components out there, but these are the ones that I’ve found more useful during my developing sessions:

  • Axios : An API that allows making HTTP requests to servers, providing some user-friendly functions to do so.
  • Redux : A predictable state container that helps you write apps that behave consistently, run in different environments and are easy to test.
  • React Navigation : A custom react component supported by the official react-native team that allows navigation between screens.
  • React Native Vector Icons : A huge library of vector icons that can be used anywhere and that work cross-platform.
  • React Native Elements : A toolkit full of components to use on your applications such as buttons, icons, tab bars, and so on.

In conclusion, if you are planning to develop and app both for Android and iOS I would definitely encourage you to try using React Native. You will save some time s almost no native platform related code is required, and if you are already pretty familiar with JavaScript this is a huge bonus, as things should be a lot easier for you.

Also, before I forget, Mark Zuckerberg and his Facebook friends announced in the last Facebook Developer Conference that took place in San Jose (California) in April that they will be completely rewriting React later this year, changing its name to React Fiber and building it from scratch. So yeah, more challenges on the way!

 

Written by Facundo Acosta, Junior Developer at GearedApp