React Native — Ready or Not

Robert Vogt
smartive
3 min readMar 1, 2017

--

React Native allows developers to create cross-platform apps on a stack they (might) already know quite well; Node, Babel, CSS and React. The technology has been open-sourced in early 2015 but has really gained traction in 2016. The question whether React Native is production-ready often arises ahead of a project start. Technologies like Xamarin or even hybrid-stacks seem to be far more mature.

Superficially, a React Native app seems to work in the same way as any other React app. The only obvious difference is JSX being resolved to native UI controls rather than DOM nodes. Using this approach offers huge performance gains over hybrid apps written with tools like PhoneGap or even Ionic, which use WebViews to render app content. Business logic is implemented as ES2015 modules and executed in a JavaScript runtime (JavaScriptCore on iOS, V8 on Android), running in parallel to the native view manager. These two parts of the framework talk to each other through a message bus. This is the job of the framework though, and not relevant for writing a (simple) app.

Crowd at Webnesday in St. Gallen

I gave a talk at Webnesday in November 2016 about this topic. If you’d like to know more you can check the slides here and the code that goes along with them on GitHub.

Knowledge Transfer

For a developer experienced in React, the differences in writing code for the web, or a native app are minor. Rather than requiring components from react-dom, components are provided by react-native. These are very well documented in the official docs. React Native tries to mimic browser behaviour wherever possible and provides APIs similar to the web environment, e.g. HTTP requests can be sent using the fetch API and GPS location can be determined by using the geolocation API. A developer with solid knowledge of React should be quite productive with React Native in very little time.

When to use

Yet knowing how React Native works does not completely answer the question whether it’s ready for use in business-critical projects or not. React Native is really good in fast-paced development cycles and can be used to create a prototype or an MVP in close to no time, assuming the team already provides React know-how. The fast-paced development speed known from the web (save-and-reload) allows for an very quick turnaround to market for new products.

React Native is not only suitable for MVPs, though. Due to React’s nature, the layout engine and the incredible React community contributing packages like React Native Community on GitHub, React Native is very well suited for UI-heavy apps. Today, most apps seem to be an alternative to a web frontend by providing a UI to an API without using any other device features. React Native is more than capable for these use cases.

If you’re planning an app with a lot of hardware-heavy features, such as Bluetooth or near field communication, React Native might not be the best fit. A lot of community packages around these hardware features can be found on npm, but it’s definitely worth investing a day or two to create a Proof of Concept. The quality and maintenance of these packages are not always on the level one would hope for.

Conclusion

React Native seems to be a fantastic tool which makes native development great fun again. I firmly believe React Native is well suited for most of today’s demands and can be favoured over other stacks. This is due to it allowing fast development cycles, and the use of a strong CSS subset for styles, and flexbox for layouting. With Facebook behind it, and a huge ecosystem around it, React Native is as future-proof as it gets.

--

--

Robert Vogt
smartive

He tried to look ashamed and succeeded simply in looking pleased with himself. — Neil Gaiman