Framework vs Library — What's the Difference?

A library is code you call into to perform a specific task, on your own terms; a framework calls into your code according to its own structure and lifecycle — a distinction often summarized as "inversion of control."

Published October 4, 2026

A library is code you call into to perform a specific task, on your own terms; a framework calls into your code according to its own structure and lifecycle — a distinction often summarized as "inversion of control."

Why they differ

  • With a library, your application is in control and decides when and how to call it
  • With a framework, the framework is in control — it dictates the overall structure of the application and calls your code at the appropriate points

How to choose

  • Use a library when you need a specific capability (like date parsing) without dictating your app's overall architecture
  • Adopt a framework when you want established conventions for structuring an entire application, at the cost of following its rules

FAQ

Is React a library or a framework?

React officially describes itself as a library — it handles rendering UI from state, but leaves routing, data fetching, and overall app structure to you or additional libraries.

More General articles