Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating new project ReactNative

Tags:

react-native

On the official website we can read how to create new project:

create-react-native-app AwesomeProject

but on tutorials I always see:

react-native init AwesomeProject

What is the correct? What is the difference between them

like image 577
github2017 Avatar asked Aug 06 '18 15:08

github2017


People also ask

Which command is used to create a new React Native project?

Starting a new project You can use Expo or create-react-native-app (which in turns uses Expo-Cli) to start your new project, but with this method you are in more control of what happend in your projecto and can communicate, tweak and write your own modules with native libraries for iOS and Android mobile platform.


2 Answers

One uses Expo and the other does not. With create-react-native-app you use Expo and native code is totally transparent to you.

With the typical react-native init, you get all the code and you can modify native code if you want (or write custom native modules).

You can find everything documented here: https://facebook.github.io/react-native/docs/getting-started.html

First tab, Quick start is about create-react-native-app, second tab Building Projects with Native Code is about react-native init.

Probably in most tutorials you find the react-native init option because that option is there from the very beginning while create-react-native-app is newer new utility.

Recommendation:

  1. If you know you will need to modify native code, use react-native init. If not, you can go with create-react-native-app
  2. Even if you go with create-react-native-app, if at some point your needs change, you can eject
like image 144
Ferran Negre Avatar answered Sep 30 '22 12:09

Ferran Negre


Referencing EvanBacon's answer, react native init creates a purely react native app, whereas Facebook's create-react-native-app makes a project "bootstrapped with expo."

like image 39
Novuw Avatar answered Sep 30 '22 11:09

Novuw