react-native-cli vs expo vs expo-cli vs react-native
React Native Development Tools
react-native-cliexpoexpo-clireact-nativeSimilar Packages:

React Native Development Tools

These packages are essential tools for developing mobile applications using React Native. They provide a variety of functionalities ranging from project setup, development, and deployment to managing dependencies and building the application for various platforms. Understanding the differences between these packages helps developers choose the right tool for their specific needs in mobile app development.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
react-native-cli24,091125,499-1,2359 years agoBSD-3-Clause
expo047,698868 kB8125 days agoMIT
expo-cli02,6642.93 MB03 years agoMIT
react-native0125,49921.5 MB1,2355 days agoMIT

Feature Comparison: react-native-cli vs expo vs expo-cli vs react-native

Development Environment

  • react-native-cli:

    React Native CLI is a command-line interface that allows developers to create and manage React Native projects without the Expo framework. It provides commands for running the app, building it for different platforms, and linking native dependencies, giving developers more control over their project.

  • expo:

    Expo provides a managed development environment that abstracts away the complexities of native code, allowing developers to focus on JavaScript and React. It includes a rich set of libraries and tools that streamline the development process, making it easier to get started and build applications quickly.

  • expo-cli:

    Expo CLI is the command-line tool that facilitates the creation and management of Expo projects. It offers commands for starting the development server, running the app on simulators or devices, and building the app for production, making it a vital tool for developers using Expo.

  • react-native:

    React Native requires setting up a more complex development environment, including native build tools like Xcode for iOS and Android Studio for Android. This setup allows for more customization and access to native features, but it also comes with a steeper learning curve and more initial configuration.

Access to Native Features

  • react-native-cli:

    React Native CLI supports the integration of custom native code, allowing developers to link native modules and access device features directly. This is crucial for applications that need to utilize advanced native functionalities.

  • expo:

    Expo provides a set of APIs that allow developers to access device features like camera, location, and notifications without writing any native code. This makes it easy to implement common functionalities quickly, but it may limit access to some advanced native features.

  • expo-cli:

    Expo CLI itself does not provide access to native features but is essential for managing projects that utilize Expo's APIs. It ensures that the development workflow is smooth and that the app can leverage Expo's capabilities.

  • react-native:

    React Native allows developers to write custom native modules in Java or Swift, providing full access to the device's native capabilities. This flexibility is ideal for applications that require specific native functionalities or optimizations.

Learning Curve

  • react-native-cli:

    React Native CLI requires familiarity with command-line operations and a deeper understanding of the React Native ecosystem. While it provides powerful capabilities, the learning curve can be challenging for those new to mobile development.

  • expo:

    Expo is designed to be beginner-friendly, with a gentle learning curve that allows developers to quickly start building applications without needing extensive knowledge of native development. This makes it an excellent choice for those new to mobile development.

  • expo-cli:

    Expo CLI is straightforward to use, with simple commands that are easy to learn. Developers familiar with command-line interfaces will find it intuitive to manage their Expo projects using this tool.

  • react-native:

    React Native has a steeper learning curve than Expo, as it requires understanding both JavaScript and native mobile development concepts. Developers need to be comfortable with native build tools and may need to learn additional languages like Java or Swift for custom native modules.

Community and Ecosystem

  • react-native-cli:

    React Native CLI is supported by the robust React Native community, which offers a variety of plugins and libraries that can be integrated into projects. Developers can leverage community contributions to enhance their applications.

  • expo:

    Expo has a growing community and a rich ecosystem of libraries and tools specifically designed for use with Expo. This support makes it easier for developers to find resources, tutorials, and third-party libraries that integrate seamlessly with Expo projects.

  • expo-cli:

    Expo CLI benefits from the broader Expo community, providing access to a wealth of documentation and community support. Developers can easily find help and resources related to using the CLI effectively within the Expo framework.

  • react-native:

    React Native boasts a large and active community, with numerous libraries, tools, and resources available. This extensive ecosystem allows developers to find solutions and support for a wide range of use cases and challenges in mobile app development.

Performance Optimization

  • react-native-cli:

    React Native CLI supports performance optimization by allowing developers to manage the build process and integrate native modules that enhance performance. This flexibility is crucial for applications that require high efficiency.

  • expo:

    Expo applications may have some limitations in performance optimization compared to pure React Native apps, primarily due to the abstraction layer it provides. However, Expo does offer tools for optimizing performance, such as lazy loading and asset management.

  • expo-cli:

    Expo CLI facilitates performance optimization by providing commands to build and publish optimized versions of the app. It helps manage the build process to ensure that the final product is efficient and performant.

  • react-native:

    React Native allows for extensive performance optimizations, including the ability to write custom native code and optimize rendering. Developers can fine-tune their applications for better performance, making it suitable for high-demand applications.

How to Choose: react-native-cli vs expo vs expo-cli vs react-native

  • react-native-cli:

    Choose React Native CLI if you want to create a React Native project without the Expo framework. It provides a command-line interface for initializing, running, and building React Native applications, giving you the flexibility to manage native code and dependencies directly.

  • expo:

    Choose Expo if you want to quickly prototype and build cross-platform mobile applications with minimal setup. It provides a rich set of pre-built components and APIs that simplify the development process, especially for beginners or those who want to focus on building features without worrying about native code.

  • expo-cli:

    Choose Expo CLI if you are using Expo and need a command-line interface to create, manage, and build your Expo projects. It provides commands for starting the development server, building the app, and publishing it, making it essential for developers working within the Expo ecosystem.

  • react-native:

    Choose React Native if you need full control over your mobile app's native features and want to write custom native code. It allows for deeper integration with native APIs and performance optimizations, making it suitable for complex applications that require native functionality.

README for react-native-cli

Running CLI with local modifications

React Native is distributed as two npm packages, react-native-cli and react-native. The first one is a lightweight package that should be installed globally (npm install -g react-native-cli), while the second one contains the actual React Native framework code and is installed locally into your project when you run react-native init.

Because react-native init calls npm install react-native, simply linking your local github clone into npm is not enough to test local changes.

Introducing Sinopia

Sinopia is an npm registry that runs on your local machine and allows you to publish packages to it. Everything else is proxied from npmjs.com. We'll set up sinopia for React Native CLI development. First, install it with:

$ npm install -g sinopia

Now you can run sinopia by simply doing:

$ sinopia

Running it for the first time creates a default config file. Open ~/.config/sinopia/config.yaml and configure it like this (note the max_body_size):

storage: ./storage

auth:
  htpasswd:
    file: ./htpasswd

uplinks:
  npmjs:
    url: https://registry.npmjs.org/

packages:
  'react-native':
    allow_access: $all
    allow_publish: $all

  'react-native-cli':
    allow_access: $all
    allow_publish: $all

  '*':
    allow_access: $all
    proxy: npmjs

logs:
  - {type: stdout, format: pretty, level: http}

max_body_size: '50mb'

Remember to restart sinopia afterwards.

Publishing to sinopia

Now we need to publish the two React Native packages to our local registry. To do this, we configure npm to use the new registry, unpublish any existing packages and then publish the new ones:

react-native$ npm set registry http://localhost:4873/
react-native$ npm adduser --registry http://localhost:4873/
# Check that it worked:
react-native$ npm config list
react-native$ npm unpublish --force
react-native$ npm publish
react-native$ cd react-native-cli/
react-native-cli$ npm unpublish --force
react-native-cli$ npm publish

Running the local CLI

Now that the packages are installed in sinopia, you can install the new react-native-cli package globally and when you use react-native init, it will install the new react-native package as well:

$ npm uninstall -g react-native-cli
$ npm install -g react-native-cli
$ react-native init AwesomeApp

Testing changes

Most of the CLI code is covered by jest tests, which you can run with:

$ npm test

Project generation is also covered by e2e tests, which you can run with:

$ ./scripts/e2e-test.sh

These tests actually create a very similar setup to what is described above (using sinopia) and they also run iOS-specific tests, so you will need to run this on OSX and have xctool installed.

Both of these types of tests also run on Travis both continuously and on pull requests.

Clean up

To unset the npm registry, do:

$ npm set registry https://registry.npmjs.org/
# Check that it worked:
$ npm config list

Troubleshooting

Sinopia crashes with "Module version mismatch"

This usually happens when you install a package using one version of Node and then change to a different version. This can happen when you update Node, or switch to a different version with nvm. Do:

$ npm uninstall -g sinopia
$ npm install -g sinopia

After upgrading to Node 4 you might also need to reinstall npm. What worked for me was:

$ npm uninstall -g npm
$ nvm install npm

See the nvm guide for more info.

Alternative workflow

If you don't want to install Sinopia you could still test changes done on the cli by creating a sample project and installing your checkout of react-native on that project instead of downloading it from npm. The simplest way to do this is by:

$ npm init AwesomeProject
$ cd AwesomeProject
$ npm install $REACT_NATIVE_GITHUB

Note that REACT_NATIVE_GITHUB should point to the directory where you have a checkout.

Also, if the changes you're making get triggered when running react-native init AwesomeProject you will want to tweak the global installed react-native-cli library to install the local checkout instead of downloading the module from npm. To do so just change this line and refer the local checkout instead.