Seshan Ravikumar

aka. Seshpenguin

← Back

title: Mobile, Web and Desktop Apps With One Codebase! (React Native/Expo) author: Seshan Ravikumar type: post date: 2019-06-14T17:27:24+00:00 url: /2019/06/14/mobile-web-and-desktop-apps-with-one-codebase-react-native-expo/ classic-editor-remember:

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:

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

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

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!