React native has come up as a performant alternative for developers who want to write once and run on iOS and Android. Leveraging on the popularity of React.js which has already become devs favorite, React Native promises to deliver on the same and be the go-to framework for developers when writing native apps for iOS and Android platforms.
Currently, there are two ways you can build React native apps, either using the
react-native-cli or by using Expo which also provides a
cli tool and is a very good alternative, we will see why.
Lets talk about both seperately first!
React Native CLI
React native CLI which provides you with the
react-native init command, this generates a plain react native project for you with separate native projects for
You can modify the native projects as you want writing native code for each platform. For eg. a very generic use case is that you may want to integrate an Analytics SDK into your app, for that you can you actually use the native
Android projects and integrate your SDK as you want writing the native code.
The major downside for this is that you need to setup build chains for both platforms on your system. For Android you will need Android Studio and for iOS you will need to setup Xcode so that you can build and test on your devices. That is specially cumbersome for someone who is not aware of these tools and build systems, specially when building for production.
Expo SDK and CLI
Expo is a free and open source project which provides developers with a toolchain built around React Native, that helps building native iOS and Android apps faster using just
The major plus which falls into the favour of using
create-react-native-app cli is that it takes away the need to setup separate build chains for iOS and Android on your system. Expo provides an inbuilt build chain which works well for building and testing on both iOS and Android devices.
Along side that, Expo SDK provides access to tons of native API's for which you would otherwise need to use a module or write your own. Expo is an exceptional tool for someone who is just getting started with React Native as it takes off all the complexity while builing a React Native app.
The only downside to using Expo is that you cannot extend the native functionality while writing your app. Which means, if you wish to integrate a third party native library or extend app functionality with native code, then you simply cannot do it. This is because Expo projects do not reveal the native
Android projects that
react-native cli does.
So, that basically means you are bound to the level of native functionality provided by React Native and Expo SDK. Saying that, Expo provides a way for you to eject the app to
react-native like project with separate native projects for
Andorid, which then you can use to integrate any third party libraries or SDKs.
Most of the use cases for apps can be covered by Expo and if you feel the need of third party libraries then you can always eject the project to the plain
react-native like project. You can also refer this guide written by people behind Expo helping you make the decision.
So if you are a developer just getting started with React Native, Expo is the goto solution for you. Try it.