This. I've never understood the insistence that react is not a framework as it totally is. Maybe it was originally a library, but the fact that we now build "react apps" is an obvious sign that it's a framework.
To me a framework is something that drives and control a major part of your code, whereas a library just helps you in writing your code.
For the same reasons I always feel like express is more library than framework. Essentially its just a thin wrapper around the http module, and aside from setting up routes, it has no control or interest in how the rest of your app works
app.get() "tailors" that generic server with user code - which will only be invoked by the express server.
app.listen()starts that generic server with the user code that "tailors" its operation ...
The framework often plays the role of the main program in coordinating and sequencing application activity
... which is exactly what app.listen() accomplishes. So express ticks all the boxes for a framework - while the main thread configures the generic server, once running, the generic server calls all the user code that was supplied via configuration.
It really comes down to:
If your code calls it, it's a library.
If it calls your code, it's a framework.
Off course by that definition the http module itself is a "framework" ... node.js Hello world
... because the module "plays the role of the main program" and the module "calls the user code".
This just illustrates that a "framework" doesn't have to be big, complex or "all batteries included".
"Something that drives and controls a major part of your code", don't you think this makes create-react-app the framework and reactjs just a library, just like react-scripts, react-dom, redux etc... We don't build react apps, we use react to build applications. React is just part of it, just like react-dom or even react-router-dom
React is the core that is responsible for "the operation in the manner of a framework" - orchestrating the application activities and only delegating to user code via inversion of control.
React components (user code) aren't being run by the event loop but by React.
So while React may look like it's just a layer between the components and the JavaScript runtime it's actually React running (calling) the components - components don't use React unless React calls them first.
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This. I've never understood the insistence that react is not a framework as it totally is. Maybe it was originally a library, but the fact that we now build "react apps" is an obvious sign that it's a framework.
To me a framework is something that drives and control a major part of your code, whereas a library just helps you in writing your code.
For the same reasons I always feel like express is more library than framework. Essentially its just a thin wrapper around the http module, and aside from setting up routes, it has no control or interest in how the rest of your app works
1988 Johnson & Foote:
Looking at the express Hello World:
... which is exactly what
app.listen()
accomplishes. So express ticks all the boxes for a framework - while the main thread configures the generic server, once running, the generic server calls all the user code that was supplied via configuration.It really comes down to:
Off course by that definition the http module itself is a "framework" ...
node.js Hello world
... because the module "plays the role of the main program" and the module "calls the user code".
This just illustrates that a "framework" doesn't have to be big, complex or "all batteries included".
"Something that drives and controls a major part of your code", don't you think this makes create-react-app the framework and reactjs just a library, just like react-scripts, react-dom, redux etc... We don't build react apps, we use react to build applications. React is just part of it, just like react-dom or even react-router-dom
TL;DR:
"Framework" !== "Application Framework"
See my other comment.
React is the core that is responsible for "the operation in the manner of a framework" - orchestrating the application activities and only delegating to user code via inversion of control.
React components (user code) aren't being run by the event loop but by React.
So while React may look like it's just a layer between the components and the JavaScript runtime it's actually React running (calling) the components - components don't use React unless React calls them first.