Discussion on: What's the difference between a library and a framework?

jvanbruegge profile image
Jan van Brügge

I agree, a framework dictates the architecture of your code, a library does not.
I think React is a great example, because does force a component model (and more) on you. But in contrast to other frameworks that give you a complete "batteries included" solution, React only does DOM (one of the reasons why I dont like it).
A library is something like snabbdom. It makes no assumtion on how your app is structured, it just gives you a patch function to apply a virtual dom description to the real dom. You can then build your architecture how you want.

marcus profile image
Marcus Müller

React has a special place in this discussion.

I would like to add a comparison for to your statement "the framework dictates the architecture of your code", for the easier understanding the difference between them:

  • The framework is the foundation of your house.
  • The library is the garage that you have your tools in.

By that principle I think React can be both but it heavily depends on how you use it.