Unnecessary Packages

Alexjamesdunlop
3 min readMar 11, 2020

--

I have noticed a trend among a lot of javascript developers lately, the creation of unnecessary packages. Always look into a package before using it and decide if it has enough value. The less packages you use the better.

Reason to use a package:
1. Time.

Reasons against using a package:
1. Better understanding of code.
2. Easy code control.
3. Independence from packages when updating.

Use a package when you believe you can’t code it in a deadline, for example recharts. It would be a huge time sink creating a charting component, recharts has great documentation and out of the box flexibility (One problem we’ve had recently is we can’t update recharts and we don’t have the time to spare to figure out why it’s breaking on update)

Instead of “Why not this package?” think “Why this package?”.
Don’t leave the understanding of the code down to package.

People have started creating node packages (I presume) for the hopes of lots of download to make their cv look better (People are not impressed by simple packages but useful ones).
There are a lot of packages based off peoples simple stackoverflow questions and instead of a quick answer, a new package is made.
A new non creditable/unneeded dependant package is made.

An example I found of this was looking into reCaptcha v3 for react. Every single answer was download this package but luckily for me I had worked on paypal with react without using a package and had an idea of how to add it without needing a package.

Replacing react reCaptcha packages

reCaptcha v3 for react is an example. Every stackoverflow answer involved download this package. Luckily I remember how I implemented the paypal button script rendering and knew I didn’t need a package.

A lot of these packages didn’t even work.
Poor documentation & They all looked similar. Something like this:

Bad splitting of configuration, instead of one file.
Now I could have just created a new package and said use this instead but why?
Here is what I did instead:

This may look like it has less out of the box than those packages.
But it has more once you see that closely resembles the google documentation.
No more dependency on anything but google!

Because of the poor documentation of those packages I noticed I didn’t actual want to use reCaptcha v3 I wanted v2. Which you may to so here that is:

Replacing axios

axios is another big example of providing something simple and unnecessary.
The documentation is good but that shouldn’t be the reason to use a package.

This uses the built in fetch function with javascript. No more dependency.

This doesn’t cover all the same things axios does but when the use case arises it easy to add the code to cover it.

Please stop answering stackoverflow question with a package.
Teach & help the community of javascript grow instead of trying capitalise.

--

--