React Native FAQ: All you want to know about React Native but you were afraid to ask (UPDATED)
We selected and answered the most common questions that pop up when people consider using React Native in a project. We hope this short guide will make things much clearer.
1. What is React Native?
React Native is a framework that lets developers build native mobile apps using JavaScript. It enables you to build an application for multiple platforms while using the same codebase.
This can shorten the development time and reduce the overall cost of building the product. Another advantage is that you don’t need two separate teams for Android and iOS, but rather a single React Native team.
2. What is the importance of React Native?
One of the most important things about React Native is that you can reuse the code that you built for different operating systems (iOS, Android).
It means working in one framework for multiple platforms. It’s a fast growing framework, too - over 2 years ago we predicted that soon it would be possible to use React Native without touching any native code, and now it’s more true than ever.
3. What’s the difference between React and React Native?
React Native is not a different version of React. React Native uses React.
Essentially, React Native is a custom renderer for React, just like ReactDOM is for Web. Apart from transforming React code to work on iOS and Android, React Native also gives access to the features that these platforms offer.
4. Is every React developer also a React Native developer?
Most of the time when developing a React Native project, we write React code, which does not really differ from the code known from React for Web, but we should be aware of the unique properties of mobile platforms – some things might not be that obvious.
React developers are not React Native developers by default. That said, we can transform React developers into React Native developers in a short period of time by giving them an opportunity to gain experience in React Native.
5. Will my React app work on mobile? Will my React Native app work on Web?
Unfortunately, no.
Most of the React code for Web relies on features available in Web browsers, so it will not work on mobile and vice versa – React Native code relies on the features available on a given mobile platform. The good news is that we can still reuse some code between the mobile and web apps, and the ability to reuse the code will improve in the future.
6.What are the advantages and disadvantages of building a mobile app in ReactJS/PhoneGap rather than using React Native?
The first thing worth mentioning is that PhoneGap was a very good solution a few years ago. Nowadays, with how technology has changed, it is no longer suitable for most users’ needs.
PhoneGap apps are hybrid websites embedded in mobile apps through a “WebView”. You could accomplish a similar thing using ReactJS, even in combination with PhoneGap, but in both cases access to native and device-specific functionalities is severely limited. The biggest benefit of React Native is much better performance than in the case of hybrid apps.
7. Why do some developers feel that Flutter is better than React Native?
Above all, Flutter is something new on the market. It is highly promoted by Google, so it has very good support. We can also imagine that this modern solution will become more and more popular with time.
In general, Flutter, as a reactive framework, has excellent performance and is easy to learn, lets you build applications which look like native ones, and offers hot reloading.
Nevertheless, React Native is still the industry standard for cross-platform mobile development. By using JavaScript, a far more popular language than Dart (which Flutter uses), it can be more easily adopted by developers.
8. Will React Native make my app look and run the same way on iOS and Android?
iOS and Android offer different sets of features, and it's not React Native’s responsibility to make these environments equal. React Native is only a way of accessing the native components in iOS and Android.
I would say that most of the time – with some effort – we can make apps on both platforms look the same, but we shouldn't. We should stick to platform guidelines when it comes to user interface. Luckily, React Native provides us with an easy way to adapt the UI to the given platform’s needs.
See also: Pros and cons of React Native
9. Should I choose React Native or native (separate iOS and Android)?
React Native is great for most apps that rely heavily on the user interface, because with little effort, we can get the UI to work on both iOS and Android, and, most importantly, we can share the business logic.
Apart from that, React Native uses flexbox for layout, which works the same way on iOS, Android and Web, so we can transfer our experience from Web instead of learning more different engines.
On the other hand, a native app is great when we consider using all the features that a platform offers, including such modules as video/audio processing or multithreading. Since React Native focuses on the User Interface only, it can be less efficient for applications with many native features.
10. Does React Native mean we don’t need native developers?
No, native developers are still needed.
They have massive experience when it comes to configuring mobile continues integration services such as Bitrise, services for internal app distribution such as HockeyApp, configuring certificates in XCode and so on. Apart from that,
React Native does not easily offer every feature that is available on iOS and Android, and native developers can make those features available by creating a custom module that expose them to JavaScript.
This used to be a big issue when React Native was a new thing, but nowadays you should be able to find libraries for most native features you can think of. Writing custom native modules is rarely needed.
React Native apps still have some parts written in native code, and this is okay.
“React Native does not mean we should use Javascript for everything, React Native does not mean we shouldn't use Native for anything” Leland Richardson, Airbnb, React Conf 2017
The future is bright and it belongs to React and React Native. ;)
This article was first published on Jun 2, 2017