What is a Framework
Very often in the front-end community we dispute which would be the best framework, discussing the various differences and the advantages, that one or the other framework brings to our team. But perhaps, even before discussing the choice, we will all have to agree on the definition of Framework and on the difference with libraries. The question may seem silly, almost trivial. What really is the answer to the question ‘Is React a Framework or a Library?’.
Framework is an English word which translates into Italian with platform or structure. It is a translation that refers to construction or architecture, but inserting it in the IT context indicates a structure in which something is built around.
Another definition of Framework that can help to understand its actual meaning is: a series of architectural decisions chosen by the team in the making and or development of a project.
By choosing a framework indirectly, we are delegating architectural decisions to the framework itself. Going more specifically, by choosing a framework we are constraining our choices. For example which language to use or whether to be reactive (showing response), in the case of front-end frameworks like Angular we are bound to use TypeScript or the RXJS (reactive Extension) library.
It could be argued that the Framework calls our code which in turn invokes and uses Libraries.
Taking Date-fns for example: it is a very used library, but at the same time easily replaceable. Unlike the framework which, even if it is actually replaceable, requires a much longer and more complex process.
Vue.js is defined as more than one framework
Moment is a library
Three.js is a difficult library to replace
Is React instead a framework or a library?
React was born as a library, but behaves like a framework.
Just think that in React there is the rule “everything is a component” that binds the developer to use certain components, such as the router.
Therefore, we can say that React is a “masked” framework.