|
|
|
|
|
by halflife
38 days ago
|
|
I’ve done plenty of hooks. Also class components. Also angular. You are writing code for an object that is inherently stateful, in a stateless design pattern. Instead of embracing state, you crate escape hatches and plugins to tap into your state, and then more escape hatches inside those escape hatches to tap out. It’s react rendering model leaking into your code. Let’s imagine react changes the rendering paradigm, and components are rendered once with only state updates. Almost all of your hooks become useless. The fact that you need to think about react internal every time you create a component is such a bad API choice that I’m amazed it still exists, and being expanded. |
|
I guess so - but react could also change (and I think did at some point) how their class methods work, how often they're triggered, and when.
I don't understand the stateless comment - hooks are as stateful as you make them, using useState or useContext or any of the other ways of maintaining data between renders.