Home > OS >  why we use --save in react js command
why we use --save in react js command

Time:09-27

I often see a key word --save parameter with react js commands. I did not understand what is this. why we use this and what is the basic purpose of this parameter. for example

$ npm install --save react-router-dom

CodePudding user response:

-–save: When this command is used with npm install this will save all your installed core packages into the dependency section in the package.json file. Core dependencies are those packages without which your application will not give desired results.

–-save-dev: With this command your installed packages will be added to devDependency section of the package.json file. Development dependencies are those packages which only meant for development purpose it will not affect the application’s result.

CodePudding user response:

The --save option used to instruct npm to include the package inside of the dependencies section of your package.json.

But in the latest version of npm , --save is no longer needed.

  • Related