The State of the Union
Hello!
I'm Tom: a software developer with 12 years experience building web and mobile apps.
My professional career includes:
Co-founded startup, built web-based touch-screen apps.
Head of mobile web at award-winning mobile app development agency.
Web-based consultancy, specialising in JavaScript development and training.
Find me everywhere as @fiznool
What is React Native?
A JavaScript framework built with the popular React library, outputting 'native' apps for iOS and Android
UI layer is 100% native
(Almost) everything else is interpreted JavaScript
You can bridge to native code if needed
Why is it popular?
It's familiar to React (DOM) developers
It supports many libraries in the JavaScript ecosystem
It (theoretically) can produce two apps from one codebase
Trouble in Paradise
moving forward, we are sunsetting React Native at Airbnb and reinvesting all of our efforts back into native.
After three months of experiments with real features , we have removed React Native completely from our app.
The mobile team here at Udacity recently removed the last features in our apps that were written with React Native.
Airbnb and Udacity had something in common: they already had native apps.
Their experiences must therefore be viewed with this in mind.
The Good
Both Airbnb and Udacity reported these benefits to using RN:
React's component-based development workflow
Fast compilation during development
Easy to build layouts with flexbox
Large ecosystem of JavaScript libraries
Shared code across platforms
The Bad
Some common issues faced included:
Difficulty at bridging existing native code so it could be used in React Native
Code sharing often wasn't possible due to differences in designs for each platform
App size increase due to RN runtime being bundled
Common components such as recycled list views were not as performant as their native counterparts
The Ugly
Frustrations from both camps:
Shoehorning a RN app into an existing (native) navigation stack was a nightmare
Coming from a strongly typed language (Obj-C/Swift/Java/Kotlin), JavaScript's weak typing felt like a step back in time
Customising the build tools was difficult and error prone
Speed of RN releases caused issues in upgrading and out-of-date documentation
Addressing some of the issues
The issues faced by these companies can be broadly categorised as follows:
Problems integrating an existing app with React Native
Greater developer expertise in native over JavaScript
Greenfield React Native projects
If you are starting an app from scratch,
using React Native is a much more attractive proposition.
By sticking to the RN ecosystem, many of the issues faced by Airbnb/Udacity can be sidestepped.
It can be a very useful tool for building prototypes,
smaller apps or apps with a consistent look and feel.
TypeScript is also recommended, to add static typing and new features to the language.
JavaScript is better than it was a few years ago!
Integrating into existing apps
If you already have a native app, you aren't likely to benefit from adding React Native into the mix.
You should probably stick to full native for now.
Best-in-class apps
Anything that abstracts from the underlying OS APIs is likely to trade flexibility for performance and control.
For this reason, if you are looking for a best-in-class premium experience, and have the budget to match, then 100% native will always be the best choice.
One more thing...
Facebook has been listening to feedback!
An ambitious rewrite of many core parts of React Native is underway.
Once completed, it should be much simpler to integrate existing native functionality with RN.
Summary
Should I use React Native for my next project?
Maybe?
It's a great tool for building cross-platform apps from scratch, with the support from a large ecosystem.
There's no silver bullet - it all depends on the requirements, budget and expectations.
References
React Native: State of the Union
By Tom Spencer
React Native: State of the Union
- 601