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.

📉 Falling 0.2x Web Development
3,539
Comments
17
Years Active
5
Top Authors
#5298
Topic ID

Activity Over Time

2009
1
2011
1
2012
1
2013
2
2014
1
2015
10
2016
20
2017
38
2018
190
2019
546
2020
594
2021
455
2022
539
2023
625
2024
262
2025
247
2026
7

Keywords

e.g JS youtu.be FP HUGE codesandbox.io OO HOC IMO reactjs.org hooks react components class classes functional callbacks component hook methods

Sample Comments

uryga Jun 1, 2020 View on HN

why do you consider Hooks a "workaround around [React's] initial concepts"?

addicted Apr 27, 2024 View on HN

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

xwdv Dec 12, 2019 View on HN

Don’t know about others but React Hooks look way easier than whatever this is.

pier25 Jun 21, 2019 View on HN

Yes, that's what the React team should have done when they implemented hooks.

danabramov Nov 1, 2018 View on HN

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

pictur Mar 8, 2023 View on HN

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.

lioeters Apr 28, 2020 View on HN

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

JMTQp8lwXL Apr 28, 2020 View on HN

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

rhaway84773 Dec 27, 2022 View on HN

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

PaulHoule Jun 9, 2021 View on HN

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.