If you are new to React Native, chances are, you have heard of this "Expo" thing (formerly Exponent.)
You tried looking up their website, but that probably left you with even more questions:
Why do I need Expo?
What does Expo provide that React Native doesn't?
Is it even worth to pick up Expo?
How are you even supposed to make sense of it all?..
Fear no more; as it turns out, "Expo" is just a few things:
- a set of components and libraries for some common things, collectively referred to as the Expo SDK; and
- a way to host, develop, and share your in-progress app; and
- a desktop application, Expo XDE, which brings everything together.
Before diving into each one, it's important to note it's not all-or-nothing. You can use the SDK without using either the expo tools or the platform.
Expo, the SDK
There is an npm module for everything: for interacting with the Facebook API, for doing In-App-Purchases, and even for adding numbers. It's not uncommon for npm modules to stay lean and minimalistic, focusing on doing one thing.
In contrast, the Expo SDK is a set of various libraries and components, which fills the gaps other community modules couldn't. Expo SDK is known for being high-quality, and it always keeps up with the new React Native releases.
There are libraries for accessing contacts, working with the accelerometer, even using WebGL in your React Native apps, and more. The official SDK API reference outlines every module.
Can you use some of these components in any React Native project of yours? Of course!
Using these is as simple as doing
yarn add expo (or
npm install --save expo), linking the native modules, and
requireing what you need.
Expo, the platform
Another face of Expo is its platform. It can act as a CDN and allow you to share your experiments with others — simply by sharing a link.
Also, it is possible to keep your code on your computer instead of uploading it to Expo, and still run it in the Expo Client app.
The only requirement of the Expo platform is, you can only use the Expo SDK and any third-party packages that do not have native modules. Running custom native code is not possible with the Expo platform.
As soon as you need to add any custom code, you will not be able to use the Expo platform.
Expo XDE, a desktop application, is what ties everything into a cohesive experience.
It allows you to create Expo projects, serve your code locally, and publish to the Expo platform.
That's not to say it's without its alternative. There is create-react-native-app by Facebook that fits Expo SDK and Expo platform into a workflow familiar from create-react-app.
What do you do?
It all depends, as always.
You can use the Expo SDK if you need any of the components it provides — no strings attached.
You can use either Expo XDE or create-react-native-app to take advantage of the Expo platform — with only one rule: no custom native code.
Using XDE or CRNA may be a blessing if you are new to React Native, but as your project evolves, you may need to write some custom native code.
That is fine, though... if you are willing to sacrifice the platform experience, that is.
You can quickly
eject and do whatever you want — but you'll have to set up Xcode and Android Studio.