The most crucial advantage of using third-party libraries is that it helps you to save time because you do not need to develop the functionality that the library gives. Instead, you can focus on the core features of your website. Even though you still need to allocate some time reading the documentation and understanding how to use it, this is just a small amount of time compared to the time will be required to develop and test its functionality from scratch.
On the subject of testing, another benefit of using a third-party library is "proof of use". A well-known library will have been used in multiple conditions and scenarios. The feedback loop from this will have resulted in bugs being reported and resolved. So, using a verified third-party library should not compromise the overall quality of your website.
Risks of using third-party libraries
Depending on a third party library means that your code is tightly coupled to that library. Let's say at some point you are required to implement more features in your app. And, the library you are using does not support the necessary functionality. In this case, you might have to find other libraries or rewrite the feature from scratch. This makes you have to spend some time to adapt it to the new library or write the function from scratch. There are, of course, ways to avoid this, such as using a wrapper or bridging component for the library. This way, your code does not directly call the library, but an abstraction instead.
Another possible risk is that using an excessive number of libraries will bloat your website by increasing its size. In turn, this will eventually affect the performance of your website. In the case of web development, it can contribute to a lower rank on Google due to slow response time.
Last but not least, the use of third-party libraries might have some security concerns as vulnerabilities in open source libraries are frequently targets for hackers.
How do I choose the right third-party library?
To answer this question, I have included the evaluative process I use when selecting third-party libraries. Once you have a candidate, ask yourself the following questions to see if it fit for your needs:
How popular is the library?
, for example, it has crowdsourced popularity evaluation built-in. Start by looking at how many stars the repository has. And then check the number of pull requests submitted for that library. When many developers trust a library, it is a good indicator of its excellent quality.
How well-documented is the library?
Quickly dive into the code and try to assess how well structured it is. Also, read through the README or its official website. Typically, good developers document clearly. A well-documented library will help make integration quick and easy, and excellent code quality will probably mean a reliable and performant library.
Does the library have the correct license?
Another essential factor that might influence your decision is licensing, as the use of libraries can be restricted based on usage. For example, you may find there are limitations if you intend to publish your product commercially. So, make sure that you are following the specific terms of each library you have used in your code.
Hopefully, this article has helped you to decide whether you should use a third-party library in your projects. Each project is unique, so treat it as such, and try to get the benefits and understand the potential risks for the particular third-party library you are using.
Libraries are not naturally evil, and using them does not make you a lazy developer. When chosen carefully, they are a great time-saving tool. However, when developers do not take a thorough and thoughtful evaluation process of selecting the right third-party libraries, things can go wrong.
- How to make strongly-typed React components
TypeScript helps developers to improve their productivity and prevent them from producing bugs.
Published on Mar 10, 2021 · 2 min read
A promise represents a value that is unknown now that may become known in the future, in other words an asynchronous value.
Published on Mar 10, 2021 · 2 min read
- React Native over-the-air app update with CodePush
Published on Nov 1, 2020 · 7 min read
- Building a simple login form in React Native using React Hook Form
A short step-by-step tutorial about how to build a simple login form in React Native using React Hook Form.
Published on Oct 6, 2020 · 9 min read
- Building floating logo bubbles on Stripe.com using React Hooks
In this tutorial, we are going to clone animating logo bubbles from Stripe.com using React Hooks.
Published on Aug 11, 2020 · 9 min read
- Building custom React Hooks to fetch data from Firebase Firestore
In this article, I want to share my experience of building custom React Hooks to fetch data from Firebase Firestore.
Published on Aug 5, 2020 · 5 min read
- Building a simple login form with Material UI and React Hook Form
In this article, I will give a short step-by-step tutorial about how to build a simple login form with Material UI and React Hook Form.
Published on Jul 23, 2020 · 7 min read
- Introduction to React Hooks
Hooks solve a wide variety of seemingly unconnected problems in React. Whether you're new to React or use it daily, you might recognise some of these problems.
Published on Jul 20, 2020 · 3 min read
- N+1 problem in GraphQL
The n+1 problem occurs because GraphQL executes a separate function – called resolver – for each field.
Published on Jul 17, 2020 · 2 min read
- GraphQL vs REST
GraphQL has been introduced as a revolutionary alternative to REST APIs. However, it has its pros and cons.
Published on Jul 16, 2020 · 3 min read
- Data fetching in Next.js 9.3+
There are two forms of pre-rendering: Static Generation and Server-side Rendering.
Published on Jul 15, 2020 · 6 min read
- Step-by-step guidelines to implement Material UI in Next.js 2020
In this article, I want to share how to integrate Material UI in Next.js applications. We will build a very basic website using Material UI and Next.js.
Published on Jul 11, 2020 · 4 min read