Hey, I'm new to frontend development and I'm trying to figure out the best approach between writing my own code and using existing libraries. For example, if I want to implement a fade-in effect, should I do it myself using CSS or JS, or would it be better to use a library like AOS? And for creating a slider, is it advisable to code it myself or should I go with something like Swiper.js?
5 Answers
Honestly, both approaches have their downsides. Relying too much on libraries can lead to a messy codebase with heavy dependencies that might slow down your site. On the flip side, avoiding libraries might waste your time when someone else has already solved the problem in a more efficient way. I usually opt for libraries unless a unique requirement makes a custom solution necessary.
It's completely fine to use libraries, especially for tasks like animations or sliders. They can save you a lot of hassle and usually handle tricky aspects well. For something simple like a fade-in, you might want to code it yourself for practice, but for more complex features, libraries are definitely the way to go.
Definitely consider using libraries when they meet your needs. Sure, you might feel tempted to code everything yourself to learn, but libraries alleviate the burden of reinventing the wheel, especially for features that require extensive testing across different devices. Just remember to choose wisely since some libraries can bloat your project.
I think it often comes down to efficiency versus learning. Using libraries can speed up your development process significantly, especially when you're working on something that needs to function correctly. But if you want to learn and really understand the underlying mechanics, coding some things from scratch can be very beneficial.
If your main goal is to create a functional application, just use the library. If the library doesn’t do exactly what you need, you can always try another one or even roll your own solution if necessary.
Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically