I am new to React Native and have seen several blog posts/tutorials use react-native install or npm install for the dependencies. What is the difference and what are the advantages/disadvantages between both methods?
react-native install xxx
is used to install a react native dependency which should be linked afterwards.
You need to link only native iOS/Android dependencies.
The same thing can be achieved by running npm install xxx
and afterwards react-native link xxx
to link the library
If you just want to install a JS only lib, you can just use npm install
npm install
Purpose: Installs all dependencies listed in package.json
.
Usage: For Node.js and React Native projects.
Command: npm install
or npm install package-name
Advantages: works for any Node.js project, manages versions and dependencies effectively, Widely used.
react-native install
Purpose: Used to install and link React Native-specific dependencies.
Usage: specific to React Native projects.
Command: react-native install package-name
Advantages: Simplified linking of native modules.
© 2022 - 2024 — McMap. All rights reserved.