DEV Community

Jonas Grøndahl
Jonas Grøndahl

Posted on

"Too complicated, a library will handle it"

Hello everybody,

I recently got an exercise where I had to make an element resizable as well as draggable. The element should have a handle in each corner allowing the user to resize in all 4 directions.

This turned out to be very difficult for me and even after implementing it, I'm not 100% understanding every calculation that had to be done in order to make it work. I wish I had the option to use a library, but on the other hand it was fun to implement it from scratch.

When was the last time you had a moment of thinking:

"Hmm, this seems complicated, surely a library 📚 will handle it"

when trying to implement certain functionality but then went ahead and implemented it yourself or even proceeded to use that library?

Discussion (1)

Collapse
dylanesque profile image
Michael Caveney

I think it's appropriate to reach for a library when it solves a problem in a very standard way and is battle tested. I always go back to that thing that Kent C. Dodds said about making yourself feel the pain of a problem before you reach for a dependency or a library to solve it for you. But it must vary by problem type, right? For example, Moment.js takes away a lot of the pain of working with dates (provided the bundle size isn't too big). On the other hand, how many React devs reached for a solution like Redux for state management when the built-in state management tools and techniques (even before Hooks) were more than sufficient? This definitely is a case-by-case thing.