Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

I read the hooks documentation. Why would someone find this pattern better than a pre-defined state object ? I don’t get it.

React seems like it’s getting more complicated every single day. I loved it due to its simplicity but now i’m not so sure.



view as:

mostly because you can encapsulate and reuse some state logic. allows for easier testing too.

You could already do that with regular functions, class inheritence, mixin, prototype inheritence, composition, event dispatching or stores.

If preventing people from being confused and doing the wrong thing was the goal, I'm not sure adding one new way to the mix is going to make things clearer.

Besides, while I agree tooling help with applying good practices, including encapsulation, it's no substitute for a good initial API design.

React and JS API are confusing, because they have been designed this way from the start. We are now adding things on top of it, again and again, without ever fixing anything at the bottom. This creates problems at the same time it solves others.

Another issue is that the JS community wants to professionalise without aknowledging that a huge part of it doesn't have the skill to do so yet. It's a community that includes many young devs with little experience, people that are not programmers but ends up doing so, devs born in a culture of instant results... It's important to address this as well, by talking to them in tutorials and documentation, by creating API shaped with them in mind, so that they can grow in empowering directions.

Instead, we create monster trucks, and they put ads on youtube to tell everyone how "easy it is to drive" and "you should do it too right now".

For me, hooks are a monster truck. And most JS devs I work with are not capable of driving that safely.


Sure, but if you can drive hooks safely, they seems to make some things _very_ clean. I'm going back through and rewriting a toy app I haven't launched yet to use hooks and it's been a joy to work with them so far.

This seems to be the response to every addition to javascript or react without addressing the above concerns.

Nothing wrong with your comment on trying to embrace it per se, but it would be healthier if this sentiment was balanced in the community with more skepticism rather than blind embrace.


Legal | privacy