We’ve already talked about some of the pains of dependency management. Other issues can arise if you’re building an application using a specific ecosystem.
Imagine you’re building a React application, and you want to use a library like OdysseyReact (Note: this package does not exist!). From the name, it’s evident that OdysseyReact depends on React. If OdysseyReact specified React as a regular dependency
in its package.json, it can potentially cause you, the application developer, a few headaches.
It’s possible that when installing OdysseyReact, NPM installed 2 different versions of React. The one you’ve specified, and the one OdysseyReact specified. This could cause strange errors at runtime, like crashes, styling issues, or other strange behaviours.
To solve this problem, OdysseyReact can instead list react
as a peer dependency instead of a regular dependency.
Peer dependencie