Getting Started With React Native Expo: A Drama In 3 Acts
My wife and brother have started a business (https://swervedating.com — we’re in open BETA!), and the next logical step for their service is to build an app. Not in a “we need an app, right?” kind of way. Their service and customers demand the benefits that a native experience offers: speed, access to camera and geolocation, push notifications, and a slick, speedy, “touchy” experience.
Act I — The Tools You Don’t Know You Need
A sane development environment is actually quite “thick.” For those who might say, “just install Docker and…” I’ll stop you right there: adding another system for a single developer who is just getting started isn’t necessary. I understand the benefits, but there’s enough to explain to him without _also_ explaining what Docker is, why it’s cool (and it is!), and how it can bring repeatability to his setup. So…
To get a base OSX environment up for Expo, you need a few things to make your life better, namely all of the source control, node, and CLI accoutrements.
- If you’re doing a lot at the terminal (and you WILL be for this), I think a better terminal is in order. Snag iTerm2 and also add the key bindings for editing commands with the native editing shortcuts.
- Start with homebrew, you’ll need it for yarn and you’ll likely find packages down the road that you need.
- Next is … NOT node. It’s git. Yup. Install it from here.
- Any JS developer who’s been bitten by node or npm differences will agree that you need some means of managing node and npm. NVM fits the bill.
- Microsoft is on their game these days, and VSCode has excellent support for the React ecosystem and pretty much everything you’d need. Download VSCode and install a React Native extension.
- Now that you have some basics, take a deep breath and install the LTS version of node and npm. It’ll take a minute, so grab a coffee.
Act II-Use Your Shiny New Tools
Open your terminal and be prepared to be wowed. By which I mean, let’s install the expo-cli and read about React Native:
- Download and install the Expo tools for iOS or Android.
- While you’re on that page, install the Expo CLI.
- And while you’re waiting for that, sign up for an account and check out your first Snack!
- If your head is spinning and you don’t recognize React, then dig in and read about it. Trust me, it’ll help.
- Also, all of this magic is really just sugar in most cases. Behind the scenes, it’s plain JS. Babel, WebPack, and Metro transpire that stuff for you. It’s black magic, and you should always understand the dark arts.
- Okay, you’re nearly ready. Take a deep breath.
Act III-Embrace Uncertainty
You now have some choices to make:
- How do you handle state management? Redux?
- What about GraphQL for schema management and isolation of fetching? Optimistic updates are cool. And you might not need Redux.
- If Redux is out, do you use Immer for immutability?
- You’d better plan for Async rendering and understand the Context API.
- Oh, and you need a theming library.
- And an Apple Dev account.
- (And Google Play)
Grab an another cup of joe. It’s time to make the truly hard decisions. NOW you can start developing your app.