Search posts, tags, users, and pages
Thanks for doing this AMA. I am starting to explore React Native. What advantages will I get if I use Exponent as opposed to working with React Native directly?
Hi Justine! That's a great question, I'm glad you asked.
I think there are two key differences:
#1. Exponent provides a native runtime with a wide range of native APIs and components exposed out of the box, on top of those already included in React Native, so you only have to write JavaScript.
React Native itself gives you the core components that you need to build almost every app: Text, TextInput, View, Image, ScrollView, Switch, Slider, Touchable (the React Native equivalent of a link), ActivityIndicator, and a few more. It also gives you access to some useful APIs, like Geolocation and CameraRoll.
But what happens when you want to add a bar code scanner, map, Google sign in, Facebook sign in, video, fetch a user's contacts, add blur or gradient or OpenGL effects, SVG, push notifications, local notifications or sensors like gyroscope and accelerometer? In each of these cases, you will need to track down a native module that someone has implemented and published to npm, make sure it's actively maintained, install it in your project (not always easy! and you need to do it on both projects), update it each time you update React Native, or possibly just write it on your own in ObjC/Swift and Java.
So, we take care of this for you. Here's a list of some of the APIs that we support on top of React Native currently: docs.getexponent.com/versions/v11.0.0/sdk/index.h… On Friday we'll publish another update that includes a handful more, and every release this grows. We test the APIs and update them for you, you don't have to think about installation except where an API key is required (eg: Google sign in), and you can expect it to just keep working as you update. If we do make some breaking changes, we'll list them in our release notes and you can update at your convenience.
#2. Makes React Native development even more like web development, for example in terms of publishing and sharing.
With Exponent, as soon as you create a project anybody in the world can open it on their phone and watch your changes live. When you want to deploy it, run exp publish or hit publish in our development tool called XDE -- this will give you a permanent URL that anybody with the Exponent app can access. If you want to deploy it through the App Store and Play Store, run exp build:ios and exp build:android and we'll give you the store-ready binaries, then all you need to do is upload them (we'll be automating this part in the future too!).
It's really incredible how liberating this is -- to be able to share native mobile experiences in the same way that you would share websites. We (and increasingly, other people in the React Native community) use this all the time to share examples on the React Native Community Facebook group (facebook.com/groups/react.native.community), for example:
We want to make building and sharing mobile experiences as fun and frictionless as it can be, we see ourselves as philosophically similar to now.sh and Ruby on Rails -- we want to remove the incidental complexity so you can just build cross-platform apps, no hassle.
So why would you ever use React Native without Exponent? Currently with Exponent, you can't write native code -- just JavaScript. If you the APIs with provide you with aren't enough, this might be necessary. We're working on solving this though! blog.getexponent.com/answered-on-slack-ejecting-f…