Need advice about which tool to choose?Ask the StackShare community!
Create React App vs Expo: What are the differences?
Introduction
In this article, we will compare the key differences between Create React App and Expo. Both of these tools are widely used in the React Native ecosystem for developing mobile applications. Understanding the differences between them will help developers choose the right tool for their specific needs.
Setup and Configuration: Create React App provides a simple and minimal setup, allowing developers to quickly start building React applications. It generates a basic project structure, sets up the necessary build tools and configurations, making it easy for developers to get started. On the other hand, Expo provides a more opinionated setup that focuses on providing a full development environment for building React Native applications. It includes a command-line interface, a development server, and allows for easy management of assets and dependencies.
Platform Support: Create React App is primarily aimed at building web applications using React. It provides optimized configurations for creating web applications that can run in modern web browsers. Expo, on the other hand, is specifically designed for developing React Native applications that can run on both iOS and Android devices. It abstracts away many platform-specific details and provides a unified development experience for targeting multiple platforms.
Native Module Support: Create React App does not provide direct support for integrating native modules, such as native device features like camera, sensors, or location. It is primarily focused on web development and does not have built-in support for accessing native APIs. Expo, on the other hand, provides a wide range of pre-built native modules, called "Expo SDK", that can be easily integrated into React Native applications. This allows developers to access native functionalities without writing platform-specific code.
Over-the-Air Updates: Expo provides a built-in feature for over-the-air updates, allowing developers to push updates to their app without requiring users to download a new version from the app store. This is particularly useful for making quick bug fixes or adding new features without going through the app store review process. Create React App, being primarily focused on web development, does not provide a similar feature out of the box.
Application Binary Size: Create React App generates optimized web bundles for the application, resulting in relatively smaller-sized app files. These optimized bundles only contain the code and assets required for the specific user's device and browser, resulting in a smaller overall application size. Expo, on the other hand, generates larger-sized app binaries since it includes a runtime and all necessary dependencies for the app to run on different platforms.
Ejecting: Create React App provides an option to "eject" from the pre-configured environment, allowing developers to customize and configure the build system based on their specific needs. This gives developers more flexibility and control over the build process and configurations. Expo, on the other hand, does not have a similar ejecting feature. This means that developers cannot easily customize the underlying build system provided by Expo, limiting their flexibility in certain advanced scenarios.
In summary, Create React App provides a simple setup for building web applications using React, while Expo is designed for developing React Native applications that can run on both iOS and Android devices. Create React App has smaller app file sizes and allows for easy customization through ejecting, while Expo provides in-built support for native modules, over-the-air updates, and a unified development experience for multiple platforms.
Hello guys, I am new here. So, if I posted without specific guidelines, please ignore.
Basically, I am an iOS developer and developing native apps for the last three years. Recently, I started learning React Native to develop apps for both platforms. If anyone out there knows any useful resources that will become a better react native developer.
#newbie
Well, the first resource I would recommend you is my upcoming book by Packt Publishing, "Professional React Native", but it's due late January next year :) . Now jokes aside (the book's real by the way :) ), the easiest way to build a iOS/Android/Web app with React Native is to do: npm install -g expo-cli expo init some-project cd some-project expo eject
You might have heard of Expo, but trust me, stay away from it. Expo highest value is that it's an already pre-configured 3 platforms environment, but if you don't eject then you're vendor-locked to what Expo has to offer in iOS and Android, which is very poor compared to going full React Native on these platforms, they can't even handle Google Sign In properly and by the way, even if your app is 10 lines of code your app size will be over 40 MB if you don't eject, yep it's that bad, plus the performance is regular and the loading times slow, not to mention that you're stuck with their build service which the free tier makes you wait for hours for a free build slot. It's important to note that when ejecting you don't lose the Web, you simply do expo start --web to start your dev environment and expo build:web to build a static website that you can serve with any web server. Regarding state management, don't bother with "lifting state up" philosophies mixed with Context API to manage your state, lifting state is a great pattern and helps your codebase, Context is great to avoid prop-drilling, but NEVER mix them to achieve app-wide state management, for that, simply go for Redux or MobX, the hype is all about Redux, but I consider MobX far better in many aspects. However, as you're getting new into this I would recommend you start with Redux AND PLEASE grab yourself npm install @manaflair/redux-batch so that you can batch updates and don't bring your app to a crawl. Forget that "connect HOC" thing with React-Redux, don't bother for a second with it, go with Hooks and useSelector and useDispatch and the likes, it will make your code SO much cleaner and smaller. Adopt clean and new Hooks philosophy, avoid writing class components as much as possible and write function components augmented with Hooks.
Pros of Create React App
- No config, easy to use2
- Maintained by React core team2
Pros of Expo
- Free15
- Hot Reload13
- Easy to learn9
- Common ios and android app setup9
- Open Source6
- Streamlined6
- Builds into a React Native app5
- PWA supported2
- Plugins for web use with Next.js1
Sign up to add or upvote prosMake informed product decisions
Cons of Create React App
- No SSR1