Seshan's Blog

keyboard_backspaceBack to Posts
Mobile, Web and Desktop Apps With One Codebase! (React Native/Expo)
June 14, 2019

Nowadays if you want to launch a new software product or service, you’ll probably end up maintaining a few codebases for your App, website, etc. At worst, you’ll have separate versions for:

  • macOS
  • Linux
  • Windows
  • iOS
  • Android
  • Windows
  • Web

And possibly more. That’s a pretty bad case though, and you can usually reduce it to:

  • Desktop (using Electron, Qt, etc)
  • Mobile (using React Native, Xamarin, etc)
  • Web (using React, Angular, etc)

This is pretty much what the current situation is like, but we can do better. What if…

  • Mobile, Desktop, and Web (using React Native)

One codebase, all the platforms! React Native has come a long way, since the early days of being acceptable on iOS and kind of meh on Android. It’s since became a very competent and widely deployed solution for cross-platform mobile apps.

More recently, React Native was extended one more platform… the Web browser! Now, your initial thoughts may be: Why use React Native for web development when regular React exists? Well, the most obvious answer is using React Native for *everything* means you only need to develop a single codebase! Plus, react-native-web uses ReactDOM under the hood anyway.

Until recently, however, react-native-web was fairly annoying to use and cooperate with regular React Native. But now, thanks to the recent release of Expo v33, there is a super elegant way to create truly universal apps that span across all devices!

Expo basically bundles everything you need to create a React Native app into a streamlined process. It consists of a few parts, the Expo CLI to create/manage apps, Expo SDK which combines a bunch of native modules, and various Expo Devtools. Another major benefit of Expo is easy testing, especially on iOS: since all you need to do is download the Expo app from the store and launch your app!

As for desktop, you can embed the web version of your Expo in Electron. Awesome stuff!

You can read more about the latest version of Expo, and trying out the new web support, from their blog post!

ID: 133