What is Library?
Reusable code you call from your own application, without ceding control of its structure.
Definition
A library is a collection of functions, classes, or components you import and invoke on your terms—you own the control flow, the library just answers when called. React, Lodash, and requests are libraries; Next.js, Rails, and Django are frameworks that call your code instead. Libraries compose freely because they make few assumptions about the rest of your application, which is why a typical project pulls in dozens of them. That freedom carries supply-chain risk: every dependency is code you ship but did not write, so weighing maintenance activity, transitive dependency count, and bundle cost is part of the decision. Tree-shaking lets bundlers drop unused library code from production builds.

