Which is better – React Native or Xamarin Forms?

Let’s talk about a loaded question.  After my recent forays into both React Native and Xamarin Forms, I got asked on Twitter – which is better, React Native or Xamarin Forms?  Further, I should answer this for JavaScript experts, C# XAML experts and for developers with experience in both.  After all, both produce native apps and both use a common codebase.

The Short Version

There isn’t a clear winner here.  If I am a JavaScript expert, I’ll gravitate towards React Native.  If I’m a C# expert, I’ll gravitate towards Xamarin Forms.  If I’m equally experienced in both (which is unlikely), then I’m likely to use React Native for everything but Microsoft-centric projects.

The Long Version

There are many facets that one must consider when starting a mobile project.  Here are the ones I looked at:

Legal Requirements

If I am producing a commercial product, then the open source components that I use must not be encumbered or there must be a commercially friendly license available.  Xamarin Forms meets these requirements.  It’s licensed under the MIT license and you get a permissive license to use Xamarin Forms when you purchase an MSDN license.  It really can’t get better than that.  React Native, on the other hand, has an awkward patent clause that makes it less than desirable in commercial products.  I would not use React or React Native in commercial products without some solid legal advice.

UPDATE (10/31/2017) Facebook has removed the PATENTS requirement from the React codebase, but not from their React Native codebase.   This continues to cause problems for commercial development.  However, their move to remove the PATENTS requirement from React is notable and I hope they do the same and free the React Native toolset similarly.

Winner: Xamarin Forms

Framework

Xamarin Forms pretty much uses MVVM as a framework style.  React Native uses the more modern one-way data flow that React provides.  Personally, I find myself more productive in the React style than I am in the MVVM style.  However, this is marginal.  I suspect that if you are already familiar with modern JavaScript web development, then you will like React style.   If you are an ASP.NET MVC, Web Forms, or other MV* developer, you will prefer Xamarin Forms.

Winner: A Tie

Development Environment

Xamarin Forms requires Visual Studio, which is a well respected IDE, but it’s only one possibility.  I know that someone will correct me and say you don’t HAVE to use Visual Studio, but let’s be realistic.  If you are developing Xamarin Forms, you are going to be using Visual Studio.  React Native, on the other hand, can use pretty much any text editor.  The command line tools are written in node, so you can use whatever platform you want and whatever editor you want.  This flexibility is awesome

Winner: React Native

Cross-Platform Development

You can develop Xamarin Forms apps on a PC and compile on a Mac easily.  You can use Expo to do the same thing with React Native, but it’s not the same.  It’s really about using cloud resources to do the work.  Expo doesn’t do everything that React Native can do, so it’s obviously lesser in this respect.

Winner: Xamarin Forms

Ready Made Components

I found pretty much equal quantity of quality components and libraries in both Xamarin Forms and React Native.  The Xamarin Forms ones were split between NuGet and the component store, and the documentation for them was, in general, worse.  The React Native ones were all in one place – npm – and the documentation was, in general, better.

Winner: React Native

Time To Productive

If I am starting from a blank mac with Android Studio and XCode already installed, and I want to produce my first app, the installation process for Xamarin Forms (installing Visual Studio, downloading the components, File -> New Project and a couple of screens) is several hours.  I completed the same process in around 3 hours for React Native.

Winner: React Native

Expert Assistance

If I look for assistance on the Internet – Stack Overflow, blogs, etc. – then I am more likely to find an answer for Xamarin Forms.  It’s been around longer and there is a community of MVPs to assist.  React Native is younger.  There is still a lot of support out there, especially for beginners.  However, you won’t find the depth of knowledge as readily available.

Winner: Xamarin Forms

Type Safety

Xamarin Forms uses C#.  It has type safety by default.  React Native uses JavaScript.  You can use TypeScript to get type safety at compile time, but it’s an optional extra.  I actually like this feature of React Native.  People coming from a static type language like C# or Java likely won’t like this feature.

Winner: React Native (for me)

Testing Capabilities

You can do UI testing in either platform.  I found unit tests to be easier to write in Jest than XUnit.    One big difference I found was that I could debug in the XCode Simulator for iOS when using Xamarin Forms.  I could only debug in the Android Emulator on React Native.  Even there, I had many issues with the emulator.  This is obviously an area that is evolving, so I expect the answer may change.

UPDATE (10/31/2017) This has improved considerably.  Check out the Visual Studio Code debugging capabilities for React Native.    I’m impressed with React Native now

Winner: A Draw!

In the end, the choice is up to you.  There is no clear winner and it will depend on your individual requirements as to which one to select.

 

 

6 thoughts

  1. Pingback: Dew Drop - May 26, 2017 (#2488) - Morning Dew

  2. Hi and thank you for this useful article. Especially the legal part, I had never considered.
    I believe however that there is an important aspect of cross platform development that is not being addressed here and that drives most of the decisions when choosing a framework. And that is the issue of performance.
    How do these two frameworks fare against each other as far as performance is concerned?
    I am mostly worried about startup time and scrolling large lists of data such as images.

    Like

    • Both run equally well on both environments. I used a PC and a Mac in the comparison (although all the coding was done on the Mac since I was doing cross-platform to include iOS). Contrary to the prevailing thought, you don’t need big beefy machines to run mobile development. My Mac is a Mac Mini from 3 years ago – I maxed out the memory, but aside from that, it’s stock. My PC is a Dell XPS13 laptop with an i5 and 8Gb of memory.

      Like

Comments are closed.