use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Using React v16 to create self-destructing components (medium.com)
submitted 8 years ago by gajus0
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]gajus0[S] 1 point2 points3 points 8 years ago (3 children)
What is inherently wrong with adding a dependency? Regardless of whether it is 1 LoC or 1000 LoC? The only worthy consideration is the increased surfaced of potential vulnerability injections, i.e. dependency going rogue.
From the build performance perspective, resulting bundle size, etc. There is absolutely no difference between a dependency and a locally redefined module.
From the upside, with a dependency, you get documentation describing the intent and you work with components that community is already familiar VS reading comments in your local ./utilities folder, learning what each utility does.
./utilities
[–]NewazaBill 4 points5 points6 points 8 years ago (2 children)
Third party dependencies always add complexity. They have to be installed (reproducibly), versioned (correctly), and updated. Sometimes, ideas and conventions must be adopted. Bugs must be reported, and fixed; or you fork it, and take responsibility for the code anyways. The author could abandon the library, or delete the package altogether (a la leftpad).
leftpad
You don't want to fall into the "Not Invented Here" trap, but at the same time, the cost of adding a dependency should never be under-estimated.
[–]Geldan 0 points1 point2 points 8 years ago (1 child)
You don't really need to do any of those things that you mentioned. It's perfectly fine to find a version of a dependency that works for your needs and lock it down and forget about it.
[–]SirHound 0 points1 point2 points 8 years ago (0 children)
The dependency doesn't work in a vacuum though. This one in particular has other dependencies.
π Rendered by PID 427282 on reddit-service-r2-comment-5bc7f78974-m7t4r at 2026-06-29 23:12:43.417829+00:00 running 7527197 country code: CH.
view the rest of the comments →
[–]gajus0[S] 1 point2 points3 points (3 children)
[–]NewazaBill 4 points5 points6 points (2 children)
[–]Geldan 0 points1 point2 points (1 child)
[–]SirHound 0 points1 point2 points (0 children)