← Home

Why React Native in 2020

June 6, 2020

This post is a draft, please don't share it. DM me on Twitter if you have feedback.

Recently we started working on the mobile app for Mailbrew and had to decide which technology to use for it.

It wasn't an easy choice. I developed native iOS applications in Swift for two years at my previous job and, especially with the recent release of SwiftUI, going full native was an attractive choice.

React Native was the other contender. I followed it from afar, having played with it a couple years ago, and it wasn't clear how many people were using it, how often it was being updated and wether the fact that AirBnb dropped it for their mobile apps was a big deal or not.

Exploring a bit more I discovered that RN is very active and it is being used by tons of apps, even if people don't go around talking about it. Shopify recently went all in with it as well, and they are doubling down on its ecosystem as they did with Rails. With such big players massively relying on it, my fears of RN being discontinued seem less and less realistic, even if Facebook decides to drop it.

Using RN will also give us an extreme productivity boost. It will be easier to target Android (I hear some teams are achieving 90% code sharing with iOS), easier to hire cheap contractors, and development will be faster thanks to the great tooling available.

In retrospect, choosing React Native seems like an obvious choice.

Tooling

I want to expand a bit more on what I mean by "great tooling", since many people coming from native development might be skeptical about this.

React

Do I need to say anything here? The components model is hands down the best way to build user interfaces, when programming and increasingly designing. Just look at Framer and Figma, both have components.

I also think that the new abstractions introduced by the React team with each update are masterpieces of software engineering and usually a joy to use. Thinking about hooks and the upcoming suspense API.

I am not going back programming interfaces imperatively, that's clearly the past.

Hot Reload

Technically part of React, but this deserves a point on its own.

You hit CMD+S and in less than a second you see your changes on screen. Coming from web this seems obvious, but believe me it is not.

In a native app, when you make changes in your code you will need to compile it, run it and go back to the state you where in before. This is how apps are being written in native land and it is mind-boggling that there have been no major improvements in this front to this day.

TypeScript

Hands down one of the best programming languages out there, with its powerful type system and its unmatched compatibility with all JS libraries.

We use it with strict: false and selectively turn on features of the language that are actually useful in avoiding bugs, while retaining the great speed and simplicity that we get when developing in pure JavaScript. This is somewhat controversial, but I invite everyone to try it if TypeScript seems intimidating at first with multiple errors popping up for every line you type.

Storybook

Each screen is a component and we can render it independently from all others. With Storybook you can build a library of these components in various states.

This is a great tool in a team to build screens independently and codify the various states so other people can go there and plug more complicated logic. This setup is a dream in a developer/designer duo like us.

Redux

With a bit of boilerplate, greatly reduced if you us Redux Toolkit, you get a centralized state for your app, with some pieces of it automatically serialized. This is a joy to use.

Especially when compared with native solutions (CoreData, UserDefaults), this also seems like the future.