3

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".

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.

zhirzh
  • 3,273
  • 3
  • 25
  • 30
  • 1
    Does the distinction matter? – Robert Harvey Oct 10 '19 at 16:26
  • I want to satisfy my curiosity and so it matters to me. It's possible that such classifications hold no value to some people since they add no productive value to anything and it's just as likely that some people genuinely need such labels for various reasons. Whether a question matters or not seems like a _harsh remark_ more than anything else. – zhirzh Oct 10 '19 at 16:49
  • Every comment on this platform, no matter how benign, seems interpreted as harsh nowadays. – Robert Harvey Oct 10 '19 at 18:06
  • Interesting answer: https://stackoverflow.com/a/66561426/11792577 – glinda93 May 24 '22 at 15:57

1 Answers1

-1

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.

Bhojendra Rauniyar
  • 83,432
  • 35
  • 168
  • 231