React Native, with or without Expo?

Are you planning to build a cross-platform app but unsure whether to use Expo in your React Native project?

When building a cross-platform app with React Native, there are two common approaches. One is to run a pure React Native project, and the other is to use Expo. Here, I intended to explain a bit about the pros and cons.

Difference between projects with and without Expo

The strength of React Native is that you can write your app in TypeScript or JavaScript, which can then be packaged into a native app on both iOS and Android, with exactly the same codebase. All the required native code (Objective-C or Swift for iOS, Java or Kotlin for Android) is handled by React Native.

From time to time, however, developers need to write their own native code, for example, to link a third-party library that requires it. In pure React Native, this is not a problem, it's just a matter of going into the generated native code and adding or changing what's necessary.

On the other hand, if your project uses Expo, that option is not available. You do not have access to the native code at all.

Why don't we have access to the native code in Expo?

Of course, it is an advantage to be able to edit the native code, but there is also a disadvantage. Each time you want to update your React Native version, you will need to update the generated native code. If you have made changes there, it can become cumbersome and time-consuming. You may need to check the diffs between the current React Native-generated native code and the new version and manually apply the changes so as not to risk losing your modifications.

Since Expo does not allow changes to the native code, you never encounter that problem. Therefore, it is safe to upgrade to the latest React Native without much trouble.

What happens if you never upgrade React Native?

Even if you would like to stick with the same version of React Native forever, there are certain risks associated with starting to edit the native code. Generated code can be difficult to understand, and since many React Native developers come from the web world, they often do not have the same understanding of the compilation steps that a native iOS or Android developer might have. There's a risk of ending up in compilation problems that can take days to resolve, and which one simply thinks “should just work”. Hard to explain to clients.

Should one always use Expo together with React Native?

Yes and no. If I were to give a recommendation, it would be to start the project with Expo and try your utmost to use the built-in links to native functions that Expo provides. My experience is that it will save you an immense amount of headache in the long run.

If you eventually have to “eject”, that is, switch to pure React Native, make sure to try to minimize changes in the native code and document thoroughly every change you make to facilitate future developers.

Always assume that there will eventually be other developers in the project, even if you happen to be the only developer right now. It also makes it easier for you when you have been away from the codebase for 6 months and are trying to continue working on it.

Photo of Viktor Hesselbom

Viktor Hesselbom

Partner & Lead Web/Unity Developer