"Too complicated, a library will handle it"

twitter logo ・1 min read

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?

twitter logo DISCUSS (1)
markdown guide
 

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.

Classic DEV Post from Apr 25

Form habits by making the right thing easiest

Tools should always work for you, not against you! Invest some time making sure you configure them to adapt to shifting conditions.

Jonas Grøndahl profile image
JS dev looking to create amazing things! language learner, coder, traveller, React addict ⚛️, ex-esport competitor, casual youtuber
Join dev.to

Be a better developer. Free forever.