Why do people call React more a library than a framework? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Why do people call React more a library than a framework?

What are the strict definitions?

17th Oct 2020, 11:43 PM
Sonic
Sonic - avatar
4 Answers
+ 9
A framework tells you how to write programs and a library is just a collection of useful code. Take for example jQuery or underscore, they are just a loose collection of functions and your project may use them a lot but underscore doesn't dictate a project structure. If you don't like underscore you can just swap it out for lodash or your own code. The asp.net framework on the other hand acts like a foundation for your project, you are writing code *within* asp.net. All your views and controllers etc. are useless if you remove asp.net, asp.net has all the necessary glue code to make your app actually do something. React is interesting, it's somewhere in the middle for sure. You have framework-y aspects; you have to put your code into components and state is managed by the magic black box. On the other hand react is pretty agnostic to how you use it. It doesn't force a folder or project structure upon you, you can use it as much or as little as you want. Outside of UI react doesn't care about what you do.
18th Oct 2020, 12:32 AM
Schindlabua
Schindlabua - avatar
+ 9
Adding to what Schindlabua explained... frameworks are very opinionated about most aspects of common cross cutting concerns in building an application. Such concerns can include the model, view, controller / router, security, caching, validation, state management, dependency injection, middleware, etc. ReactJS is technically just a view library which serves only one of many aspects of the application. The many other aspects are a bit plug n play which can work with a variety of other libraries.
18th Oct 2020, 2:12 AM
David Carroll
David Carroll - avatar
+ 6
Thank you for your answers David Carroll and Schindlabua (good to see you back).
18th Oct 2020, 2:18 AM
Sonic
Sonic - avatar
+ 4
React is a library if seeing from perspective of the whole application aspect, however, from the aspect of view, it can be considered as view framework.
18th Oct 2020, 2:08 PM
Calviղ
Calviղ - avatar