First there were the VCR wars (VHS vs. Betamax—look it up if you’re too young to remember). Then there were various game console wars (Atari vs. Intellivision, Sega vs. Nintendo, Xbox vs. PlayStation), browser wars (Mosaic vs. Netscape, Netscape vs. Internet Explorer, Internet Explorer vs. Firefox vs. Chrome…), and mobile platform wars (iOS vs. Android). You’d think that, as a society, we’d be getting tired of these belligerent metaphors. In case we’re not, here’s another one: The cross-platform mobile development framework wars, pitting React Native vs. Xamarin. It’s a bit esoteric to begin with and doesn’t exactly roll off the tongue, so it’s unlikely to become meme fodder. Thankfully.
So what’s it about? React Native and Xamarin are both frameworks for cross-platform mobile app development. This means that developers can maintain one code base and generate executables for both iOS and Android. Without one of these frameworks (or one of several others on the market), developers have to maintain separate sets of code for each platform, which means twice as much effort to develop and maintain the same app. It also complicates keeping the two versions in sync.
Differences and Similarities
Other than the fact that they are both designed for cross-platform development, there are actually few similarities between the two frameworks. They approach the task from different angles, and therefore require somewhat different mindsets to use. Here are some of the major differences:
- Language and development environment. Xamarin uses C# and is best developed in Microsoft Visual Studio. React Native uses JavaScript and reportedly can be developed with any text editor.
- Code deployment. Xamarin requires a compilation step to generate an executable that can be tested on an emulator or device. Depending on the complexity of the project, compiling can take a long time—several minutes or more. React Native uses “hot module replacement,” where you simply save the code and can see the results instantly.
- Code re-use. This metric is high for both frameworks. Xamaran adherents claim up to 96 percent of code can be shared between the two platforms; the figure is closer to 75 percent for React Native. It really depends on what you’re trying to accomplish and how much of the functionality depends on the unique features of each platform.
- Licensing. For commercial products (i.e., products that people pay for), developers have to be careful about using open-source libraries. Reportedly, Xamarin is easier in this regard; React Native has licensing requirements that are more complex to navigate.
- Framework maturity and support community. Xamarin has been around longer and was also acquired by Microsoft, so the release strategy is more formalized and standardized. This tends to make developers happy because the framework is more stable and predictable, and typically is better documented. React Native is supported mainly by an open-source development community and still technically in beta at this writing, so stability may be an issue until it matures.
Which Is Better?
It’s difficult to call one framework better than the other. Mostly it will depend on what you are accustomed to as a developer. Developers experienced in .NET in general and C# in particular will find it easier to develop in Xamarin. Experienced web developers will typically gravitate towards React Native. People who have actually used both (and have expressed an opinion about it on the Internet) tend to favor React Native, but this is a small community indeed.
When you think about it, the differences and similarities between Xamarin and React Native are mainly points of personal preference for the developer. You can split hairs over whether one framework is better than another with regard to a specific aspect of development, testing, or maintenance, but at some point it resembles an argument over whether Xbox is better than PlayStation. The choice will largely boil down to what the developer or team is most comfortable with. The results—the quality, usability, look-and-feel and performance—of the end product is what really matters, isn’t it? And both frameworks do an admirable job of generating mobile apps that “feel” like native apps on each platform.
The Future
Both frameworks continue to improve as they mature and as more developers become experienced with them. The developer communities generally come from different experience backgrounds, so there will be few who “convert” from one to the other. Thus, there seems to be no reason why one would supplant the other, so it’s reasonable to expect they will coexist for quite some time. And in a world filled with so many metaphorical wars, isn’t that a nice thing?