3 ms·
>For almost 10 years, the core react developers would repeat incessantly: React is a library, not a framework. I always disliked the it’s a library not a frame
by rafark 2y ago
>For almost 10 years, the core react developers would repeat incessantly: React is a library, not a framework.
I always disliked the it’s a library not a framework debate. Isn’t any library a framework, technically?
- erik_seaberg 2y agoYou call a library as you see fit. A framework calls you.
- recursive 2y agoOh yeah. I guess that's why we always invoke function components directly. Because it's a library. /s
- throwAGIway 2y agoWhat do you think you're doing when you call render(<App />,...)?
- recursive 2y agoNot calling App. Creating a react element with a reference to the function. The reconciler will call it later, asynchronously. Put in some console logs and see the order of operations for yourself. Also, try calling App and see what happens if it uses hooks.
- throwAGIway 2y agoThe createElement function is called immediately, and it immediately calls your component function. I don't think this is a significant difference. Many libraries accept a callback and I'm really not ready to call all that a framework just based on that.
- recursive 2y agocreateElement is immediate. The component function call is not. It may never be called. Try const a = <App />; App() will never be called.
- throwAGIway 2y agoYeah, it will be called when you call render as in my original comment. Again, I don't think that passing a callback makes a framework.
- recursive 2y agoWhen you combine that with the fact that you can't invoke the function directly, this seems like the textbook definition to me. Agree to disagree I guess.