My understanding of the vital difference between a library and a framework is whether my application code uses the package code or the package runs my application code - otherwise called "inversion of control".
It makes sense that react
is a UI library since I can create a DOM interface (its representation).
But when I want to render it using react-dom
, my application can only trigger a render (by calling ReactDOM.render()
, state updates or forced updates) but it is upto react-dom
to decide when to render it.
Since react-dom
takes up the responsibility to render the UI, does it qualify as a framework? And if not, please give an explanation so I can clear my understanding of the topic.
PS: Perhaps SO is not the best place for this question. If you know a better on, do let me know.
ReactDom is not both of a library and a framework. A single piece of code or method cannot be considered as a library or framework. To be a library it contains many methods and to be a framework it contains many library.
So, you'll need to understand what is library and framework ? And if you have a question on react itself as if it's a library or framework, then read these blogs: medium and dev.to - you'll find it stating react is a library.
But I would say it is a framework because it includes many library. And many other blogs indicates it as a framework as well. To conclude, this is huge opinion based result for what you understand it as a library or a framework.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.