DEV Community

Jonas Grøndahl
Jonas Grøndahl

Posted on

3

"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?

Top comments (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.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Instrument, monitor, fix: a hands-on debugging session

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️