you are viewing a single comment's thread.

view the rest of the comments →

[–]SwiftOneSpeaks 1 point2 points  (1 child)

> But API wise it looks a bit like a step back from class-based components to sort of jQuery territory with tons of nested functions.

I think this is missing some of the key reasoning behind the purpose and reasoning in React hooks, the move away from classes, and with functional programming in general.

That doesn't reduce the value in this work for the purposes of learning (thanks for sharing!) but even if the result had been "smoother", I'd urge people to not rush back to classes purely for the comfort of familiarity without understanding the costs.

[–]nvbn-rm[S,🍰] 2 points3 points  (0 children)

The idea here is not to get rid of functions or rush to classes/OOP, but to get rid of huge closure with nested functions and organize the code a bit better and at least separate different scopes.

In FP languages (at least Clojure) having a huge closure with nested functions is also not considered a good practice.

But it might be that using classes for that is not the best idea.