|
|
|
|
|
by krzepah
2116 days ago
|
|
I haven't rushed out to hooks when they got out (i'm a preact user not react) to the point that I got an intern tell me "Oh you don't use hooks, I'm not used to work like that". After digging into them, they are a nice addition for some specific niche scenario where the component is not using any kind of global storage. But from the little experience I had, they bring almost nothing new (I could do the same without them) and they are also kind of difficult to read. If I had to put a ADR for it, I'd simply skip it trough and specify storage / class components as being much better just because of readability and consistency. Now maybe they have some better perf but it seems to me they are an addition that came because of the functional frenzy that react has gone trough. Maybe we got too far, maybe we didn't really need them. Maybe they just look cool. In the end, i've replaced all my hooks with either GS or Component just because I'm more confident about how my peers will be able to read the code. |
|
I prefer the class-based approach for stateful components because at least then it’s clear that the component has some state it is managing and how.