Search code examples
react-nativeexpo

Difference between expo-dev-client & npx expo prebuild & npx expo run:ios/android


I'm really confused on the following topics, 1.expo-dev-client (why not expo go?) 2.npx expo prebuild 3.npx expo run:ios/android

I'm coming from react-native-cli background and I really feel overwhelming after finding documentations and videos for the above topics. I didn't understand what the documentation says too. Can somebody tell me the purpose of the above topics. I know what npx expo prebuild does. but I'm not sure whether other things do or doing the same thing as prebuild does. And why I saw some people have commented better using expo-dev-client than expo go. Can somebody briefly explain. Thanks. I really appreciate


Solution

  • When you're first starting a new Expo project, you might reach for Expo Go because it's pre-built and will run a standard Expo-based app pretty easily. This can be the fastest option.

    But once you're ready to:

    1. Modify any native code for your app
    2. Ask other people to test out the app on real devices

    You should move over to expo dev client. Expo dev client will create basically a "custom" version of Expo Go, specifically for your app. It's a little more complicated than that, but that's a good way to think about it.

    For most projects, you really shouldn't need expo prebuild. It's an escape hatch to make sure Expo users aren't totally locked in to Expo tools. The idea is you take your Expo project and use it as a source to generate the native code. It's what they'll do for you in the EAS build services. You can run it locally. I usually use it to troubleshoot EAS errors on my machine. I run it very infrequently.

    Since expo prebuild will generate Android and iOS folders for you, in theory, you could use it kind of like you would with regular React Native CLI - to build all of the native components of your React Native app. But with Expo dev client, you basically never need this.

    I do not agree with the characterization of Expo dev client as experimental. At one point that was true (when they were developing it!) but these days, it's a viable option, and it's the recommended path to take when doing Expo app development that touches native code.