Reading time: < 1 minute
If we want to add dependencies in React or React Native and also have them saved in the package.json file, we will do the following:
npm install library_name --save
We use npm install to invoke the npm installer, followed by the library we want to install, and add –save. This will add the library to the package.json file under “dependencies”.
To apply this, for example, to the React Native Paper library, we will do the following:
npm install react-native-paper --save
And we can see how it has been added inside package.json
If we want to install all the dependencies from the package.json file of our project, we have to use the following command:
npm install