React Hooks Debate
Discussions revolve around the pros and cons of React Hooks compared to class components, including criticisms of their complexity and magic, praises for reducing boilerplate and improving composability, and debates on their design and rules.
Activity Over Time
Top Contributors
Keywords
Sample Comments
why do you consider Hooks a "workaround around [React's] initial concepts"?
TLDR - Hooks are a lie. Pretend “hooks” as a term or concept doesn’t exist. Treat every hook as a unique and independent concept and learn each separately and individually.1. The purpose of specific hooks have silently changed over time - You’re not the only one confused. The React devs themselves were confused about what they wanted to do with hooks. For example, useEffect is for managing side effects according to the old documentation whereas the new documentation says it syncs external sy
Don’t know about others but React Hooks look way easier than whatever this is.
Yes, that's what the React team should have done when they implemented hooks.
While I see why you might feel this way, I wrote an article about this and would appreciate if you give it a read. https://medium.com/@dan_abramov/making-sense-of-react-hooks-...
React hooks could have been very different with very minor touches. But at this point, a structure has emerged where you need to make extra efforts to work steadily. It wasn't like that at the core of React. Class components had their own problems. But you know how to solve them. I don't think this applies to react hooks.
Nice resources! I've bookmarked them for later study.That last one I like, especially where the author recommends to "forget everything about lifecycle methods" and think of hooks in the context of synchronization. It makes sense, as a declarative way to describe state and state transitions.The aspect that's unsettling is that they're not idempotent pure functions, but rather deeply tied in with how React works internally. They can't be used outside of
This is the most legitimate criticism I've seen in the discussion. Hooks give you more control. 'useEffect' will only re-run when any value in the dependency array is updated. In class syntax, you have 'componentDidUpdate', but that function gets called after any prop or state change. With hooks, there is more granularity. Personally, I've found reasoning about hooks to be a learning curve that was conquerable in about a week. But there is no arguing, it requires yo
Hooks allow functional components to be used for non pure components.Which is a huge win IMO because the whole class/object paradigm in JavaScript is broken, and tracking what ‘this’ might be is literally impossible.I think that’s sufficient reason to use hooks.Hooks bring a completely new paradigm and I think it was brought out of Beta too early, so React now has to stick with certain concepts that appear bad ideas in hindsight (a fairly simple and relevant example would be that r
Functional components in React are fine. (A pure component that just maps props to a DOM tree)The hooks however are cancer; React going forward with those is like trying to go forward in reverse gear. Replace a straightforward OO API with something "functional" where the result depends on the sequence the functions get called in...Side effect city.