3 ms·
React is a framework that doesn't want to admit it's a framework. If you follow its recommendations like Hooks, you have to write your JS a "special way" since
by hitekker 5y ago
React is a framework that doesn't want to admit it's a framework. If you follow its recommendations like Hooks, you have to write your JS a "special way" since React owns your component lifecycle.
Put simply, React calls your component, your component does not call React. Your UI code needs to work inside of React, not around it.
The relevant and most upvoted HN article on the difference between libraries and framework is:
https://www.brandons.me/blog/libraries-not-frameworks https://www.brandons.me/blog/libraries-not-frameworks
- bacro 5y agoExactly!
- wayneftw 5y agoEverything that you can do with Hooks can be done with Class components though. Of course Class components also have a lifecycle that is managed by React. But the existence of a managed lifecycle does not make it a framework either. The article you linked has the answer: > has it established ways of doing things that are mutually-exclusive with other ways those things might be done? The answer here is a solid No in the case of React. Nothing is mutually exclusive, because you choose to use Hooks in one component, a Class in another and you can still use React.createElement elsewhere and straight HTML with vanilla JS even somewhere else.