News for hackers. Stuff that matters.
Re:Thinking in React Hooks by acemarke on Thursday December 12, 2019 @02:42PM (#21775519)
Hooks definitely bring a different set of tradeoffs, especially compared to Higher Order Components. I'm a Redux maintainer, and the React-Redux API is a good example of this. The `useSelector` and `useDispatch` hooks are way easier to statically type than `connect` is, but calling those hooks embeds knowledge of Redux directly into the component instead of separating it.

I specifically talked about these differences in my post "Thoughts on React Hooks, Redux, and Separation of Concerns" [0] and my ReactBoston 2019 talk on "Hooks, HOCs, and Tradeoffs" [1].

For myself personally, I've completely switched to writing function components as a standard practice, but we've also got a lot of devs who are newer to React and still writing classes. I don't feel a need to force rewriting all of those to function components, although I will probably find some time to let folks know that function components + hooks are a thing.

[0] https://blog.isquaredsoftware.com/2019/07/blogged-answers-th...

[1] https://blog.isquaredsoftware.com/2019/09/presentation-hooks...

Re:Thinking in React Hooks by wilsonrocks on Thursday December 12, 2019 @03:15PM (#21775910)
Totally agree about useState and useDispatch... So much easier! It is true that it beds knowledge in the component, but how likely am I to replace redux in a working app?
Re:Thinking in React Hooks by nsenifty on Thursday December 12, 2019 @04:30PM (#21776718)
Additionally, you can write your own hooks that invoke redux hooks internally and hence provide reusability and separation of concerns.