Should you use Expo for React Native?
Last update: 2024-02-11React Native has been a game-changer for developers wanting to write mobile applications using JavaScript, and a common dilemma faced when starting out is choosing between Expo or React Native CLI.
The Expo vs React Native CLI Crossroad
Stepping into the world of React Native development presents you with a critical choice at the onset — should you opt for the Expo Quickstart or the more traditional React Native CLI Quickstart?
This choice can be daunting, especially for newcomers. Let’s break it down into what matters.
Traditional Approach: React Native CLI
The React Native CLI method is the older, more mature route:
- Set up your environment with all the necessary tooling (like Ruby, Node.js, and possibly Xcode for macOS).
- Generate a new project with an initial command.
- Launch React Native Metro bundler and start your apps on iOS and Android.
This method provides complete control but can seem overwhelming with package linking and managing native iOS and Android project intricacies.
Nonethteless, many companies still use the React Native CLI approach so you might have to work with it at some point.
Enter Expo: A Streamlined Alternative
On the flip side, we have Expo:
- Install the Expo Go app on a device or simulator.
- Initialize a new Expo project.
- Run
expo start
or use a template and obtain a QR code that, when scanned, launches your app pronto!
Expo is an open-source platform that smoothes out many hassles by providing a suite of tools including the Expo SDK, Expo CLI, Expo Go app, and even Expo Application Services (EAS) — a cloud solution for app building and submission which means, you can build an iOS app without owning a Mac!
Tip: Expo is like an all-inclusive resort for React Native developers, bundling utilities and services that make app development feel like a breeze.
But there was a catch in previous years. Expo’s streamlined workflow and managed ecosystem came with limitations in the past, prompting some to prefer the freedom of React Native CLI.
Debunking Expo’s Drawbacks
Recent advancements in Expo have addressed many of the concerns called out by developers over the years:
- Clipboard Access & Linking: Previously a deal-breaker, Expo now offers
expo-clipboard
andexpo-linking
for these capabilities. - Push Notifications & In-App Purchases: With packages like
expo-notifications
and integration with third-party solutions like RevenueCat, these features are within reach on Expo.
Native Modules: A Turning Point
One of the fiercest criticisms was the inability to use custom native modules in Expo. This is no longer true—with documentation and tooling support, crafting your bespoke native modules for Expo is perfectly viable.
The Eject Dilemma: Solved by Prebuilt
The specter of ‘ejecting’ from Expo — a fancy term for ditching the managed workflow when it doesn’t cut it — has haunted developers in the past. But with Expo’s new prebuild
command, you can generate Xcode and Android projects within your React Native codebase and manage them directly without the pains of the traditional eject.
npx expo prebuild
Smooth and efficient, the prebuilt command is a game-changing replacement for expo eject.
Tackling Current Limitations
Though many past concerns have been mitigated, some wishes are still pending in the Expo wish list. Always consult Expo’s feature request board to check if there’s something you can’t live without that isn’t yet supported by Expo.
But even in that case, prebuild
gives you all the freedom in the world to include whatever code or dependencies you need.
Workflows: Getting the Best of Both Worlds
Expo offers two main workflows:
- Managed Workflow: An easy start with no native project management needed—ideal for beginners.
- Bare Workflow (Continouis Native Generation): More control where you interact with native code, yet you can still benefit from Expo’s tools.
In 2024 with Expo, you’re never locked in — you can transition fluidly between managed and bare, depending on your project’s needs.
Additional Perks of Using Expo
Aside from the simplified development process, here are some golden nuggets about using Expo:
- Ease of Use: Build and deploy native mobile apps without ever touching native code directly.
- Cloud Builds: With EAS, even Mac-less developers can build and submit iOS apps.
- Over-the-Air Updates: Deploy JavaScript, styles, and images updates directly to users, bypassing app store reviews.
- Web Development: Port your React Native app to the web, maintaining a single codebase for all platforms.
The Verdict: Is Expo “Epic” in 2024?
Crowdsourcing opinions on Twitter, the consensus tips overwhelmingly in favor of Expo. The conditions have shifted—where previously hesitation may have been advisable, now Expo garners enthusiastic approval for most React Native projects.
But…if you’re one of those who demand the raw power of React Native CLI or have specialized needs, you still have that avenue open.
Conclusion: To Expo or Not to Expo?
The choice is simpler in 2024 and beyond. For most apps and especially for those new to the scene or those looking for a speedy development cycle, Expo is a firm ‘yes’.
If you find yourself requiring direct access to native APIs or complex custom modules, a more hands-on approach with React Native CLI might be necessary.
And another reminder: Almost all app companies I talked with including Infinite Red, Callstack, STRV and others use Expo for their projects.
They can’t be wrong.