When do you use a JavaScript library instead of writing your own code?

In my article on myths about vanilla JS, I mentioned that vanilla JS doesn’t mean you always write everything from scratch yourself…
I use helper functions and small libraries all the time. A lot of very talented people have done a lot of great work to make the web faster, safer, and easier to build. Stand on their shoulders!
One common question I get whenever I say that is…


This content originally appeared on Go Make Things and was authored by Go Make Things

In my article on myths about vanilla JS, I mentioned that vanilla JS doesn’t mean you always write everything from scratch yourself…

I use helper functions and small libraries all the time. A lot of very talented people have done a lot of great work to make the web faster, safer, and easier to build. Stand on their shoulders!

One common question I get whenever I say that is…

So… when do you choose to use a library? And which libraries do you use?

I tend to reach for libraries for things that are complicated or involve a lot of moving parts.

For me, that often means “media and animation stuff” like interactive image galleries. I use PhotoSwipe for that. It also means security stuff like data sanitization. I use DOMPurify for that. And it means complicated math stuff like currencies. I use Dinero.js for that.

And if I wrote my own code, but I think it’s something I might reuse on other projects, I’ll often make it into a library that can be easily customized through options and settings.

I maintain a list of libraries that I use and enjoy over at the Vanilla JS Toolkit.

👻 A scary good sale! Today through Halloween, get 30% off every one of my vanilla JavaScript courses, ebooks, and bundles.


This content originally appeared on Go Make Things and was authored by Go Make Things


Print Share Comment Cite Upload Translate Updates
APA

Go Make Things | Sciencx (2022-10-28T14:30:00+00:00) When do you use a JavaScript library instead of writing your own code?. Retrieved from https://www.scien.cx/2022/10/28/when-do-you-use-a-javascript-library-instead-of-writing-your-own-code/

MLA
" » When do you use a JavaScript library instead of writing your own code?." Go Make Things | Sciencx - Friday October 28, 2022, https://www.scien.cx/2022/10/28/when-do-you-use-a-javascript-library-instead-of-writing-your-own-code/
HARVARD
Go Make Things | Sciencx Friday October 28, 2022 » When do you use a JavaScript library instead of writing your own code?., viewed ,<https://www.scien.cx/2022/10/28/when-do-you-use-a-javascript-library-instead-of-writing-your-own-code/>
VANCOUVER
Go Make Things | Sciencx - » When do you use a JavaScript library instead of writing your own code?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/10/28/when-do-you-use-a-javascript-library-instead-of-writing-your-own-code/
CHICAGO
" » When do you use a JavaScript library instead of writing your own code?." Go Make Things | Sciencx - Accessed . https://www.scien.cx/2022/10/28/when-do-you-use-a-javascript-library-instead-of-writing-your-own-code/
IEEE
" » When do you use a JavaScript library instead of writing your own code?." Go Make Things | Sciencx [Online]. Available: https://www.scien.cx/2022/10/28/when-do-you-use-a-javascript-library-instead-of-writing-your-own-code/. [Accessed: ]
rf:citation
» When do you use a JavaScript library instead of writing your own code? | Go Make Things | Sciencx | https://www.scien.cx/2022/10/28/when-do-you-use-a-javascript-library-instead-of-writing-your-own-code/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.