No you don't have to. react-chartjs-2
exposes chart.js
as peerDependency
to expose to you its dependency.
This way if there is another chart.js
incompatible version (it may come from another package that also depends on chart.js
) npm will warn you during installation process about it, therefore you can handle the inconsistency properly.
If react-chartjs-2
haven't added it as peerDependecy
, then you could face with different chart.js
versions being installed, and it would may cause your application to crash.
To sum up, you would prefer to declare peerDependecies
if you are building some plugin/library that it's expected to be consumed by others.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…