1

There are two parts to this question:

  1. I have recently started working on react-native and I am struggling to understand where do we use npm, expo, npx or yarn. I am working on a mac machine and trying to run my app on ios simulator.

  2. Once globally if I install react-native, Am I required it independently in each project when I create.

leonheess
  • 5,825
  • 6
  • 42
  • 67
sver
  • 718
  • 10
  • 36
  • Two CLI are there, Expo and React Native. In Expo, you can install the expo app on your mobile to see the preview. If you want to playaround with the native code, you can you use RN cli. – Aravind S Dec 18 '19 at 10:31
  • how have you installed you react native app? by npm install -g expo-cli . or . npx react-native init AwesomeProject – Gaurav Roy Dec 18 '19 at 11:10
  • the latter one : npx react-native init AwesomeProject – sver Dec 18 '19 at 11:13
  • Vote on [this proposal](https://meta.stackoverflow.com/questions/354583/disentangle-the-yarn) to ease the tag confusion around [yarn] and [yarnpkg]. – leonheess Feb 11 '20 at 16:39

1 Answers1

0

You can create your own app through expo cli or react-native-cli. There are some advantages and disadvantages on both cli.

Both cli recommend you to install dependency packages through npm or yarn. So you can use anyone. If you notice the doc of react-native, you can see that packages installation instructions are provided for both npm and yarn.

Advantage of expo-cli

  1. You can run your app through expo client's app, no need to install the apk.
  2. Also after running your app with expo-cli you can run your app by scanning the QR code.

The main disadvantage of expo-cli is, normal hello-world app's apk file is too big.

Advantage of react-native-cli

  1. You can fully control your app on this cli
  2. App's size is not too big as expo-cli

You can't run your app through QR code like expo. You have to install the apk file.

Also there are more advantages and disadvantages both cli have. I am using react-native-cli.

Hope this would be helpful for you. Thank you.

Shahnawaz Hossan
  • 2,243
  • 2
  • 10
  • 20
  • That makes sense. But what about npx and yarn? If you can edit your answer to explain that too! – sver Dec 18 '19 at 11:43
  • When you create a react-native app, its' packages are installed via yarn, and `npx ` means whether `command` is found or not. For details you can see [this](https://stackoverflow.com/questions/50605219/difference-between-npx-and-npm) answer. – Shahnawaz Hossan Dec 18 '19 at 12:04
  • @sver , If this answer helps you, you can accept it because this will encourage me a lot to help others. – Shahnawaz Hossan Dec 24 '19 at 17:22