Return to site

Mobile apps with React Native

You should build your next mobile app with React Native. Why?

· Development,react,React Native

React Native is a framework which allows you to build native applications for mobile platforms using just pure JavaScript. The foundation behind React Native is React - a hot library well adopted in web development. Both were created by Facebook and now are strongly supported by the developer community.

In our opinion, React Native will play a major role in mobile app development in future.

Learn once, write anywhere

React Native was initially created to support iOS mobile development. Soon, Android was adopted and became available as a target platform. Today, both have very nice support and currently, using only JavaScript codebase, you can achieve almost everything you would do with native Java or Objective-C / Swift. If you happen to hit a wall though (which is rarely the case), you can always plug in some native bits of code.

Nowadays, shortly after iOS and Android, next platforms are getting React Native support - namely Windows Mobile and tvOS. Web development is also an option (you would normally go with bare React, but if you aim for a single codebase shared across web and mobile apps, then React Native for Web might be an interesting option).

You can even create native desktop apps for macOS and Ubuntu using almost the same approach as for mobile development. Supposing that JavaScript is your programming language of choice, you're no longer limited to Electron with its CPU-intensive and battery-draining apps.

It turns out that Facebook's words „learn once, write anywhere” seem to be true after all.

From the business perspective, the key take-away is that it makes a lot of sense to go with a technology like React Native and have the apps delivered by a single team of full-stack developers, rather than spend lots of money on implementing and maintaining multiple native applications in parallel and hire different teams of engineers who usually specialise in either web, Android or iOS.

Native as with React Native

React Native is all about building UIs. It’s very different from other existing solutions like Apache Cordova, Ionic, PhoneGap or other hybrid technologies. It doesn’t require a WebView (basically an embedded Chrome browser) as a container for your entire application. All components created in React Native's JSX markup are mapped directly to native components. In other words, all components built with Javascript have their own counterparts in Java / Objective-C.

What's more, you can easily embed ReactNative views inside your existing native apps. The opposite is also feasible, i.e. you can plug native blocks of code into your React Native JavaScript application.

One of the greatest advantages of React is high performance. This combined with a fact that React Native compiles your code into native components, makes your mobile apps blazingly fast, and in effect the users won’t ever notice that your app was written in pure JavaScript.

Developer experience

React (especially combined with flux) has quite a steep learning curve at the very beginning. But once you get past it, you can get really productive with the library. But if you have some experience working with React, then creating your first mobile app with React Native would be a piece of cake. You write your components exactly as you would build UI for web applications. The main difference is that you can actually use the exposed native APIs, and on the other hand, browser APIs are no longer available. Thankfully, the official documentation does a very decent job in making it all clear and comprehensible for developers.

From our experience, React Native suits well for rapid prototyping, but also for developing large and well-established apps.

With React Native you are on the cutting edge of JavaScript stack: async/await, promises, generators, ES6, ES2017, even ES2018 - it’s all possible because you can use Babel transpiler, similarly as for web development. Thanks to the hot module reload feature, you don’t need to recompile the whole thing upon introducing changes in the code. You can create user interfaces really quickly thanks to an intuitive flex box styling model (yes, almost the same as CSS flexbox, known from web development). Native animations is definitely a big win in performance over existing hybrid frameworks based on WebViews.

You are used to your favourite libraries, like Lodash, Redux, MobX or other? Not a problem, these will end up bundled into your native application. Testing your apps couldn’t be easier, too. Mocha, Jasmine, Jest? Piece of cake. Functional tests on emulators or real devices using Appium? No problem. Testing your UI interactions on user events? Bread and butter. Testing business logic? Couldn’t be simpler with all the tools available out there.

Last, but not least, the developer community is just astonishing. With each published npm module, the capabilities of the React & React Native ecosystem grow.

If you are still not convinced, here are just a few examples of mobile apps built on top of React Native: Facebook, Instagram, Walmart, Tesla, Airbnb, Bloomberg, Vogue, Uber, Kontist.

All Posts

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!