Hacker News new | ask | show | jobs
by thomas_moon 1637 days ago
Thank you for this post! I have been searching for something that goes a bit deeper than most medium blog posts. I was surprised at how much of the React tidbits I have picked up through trial and error but couldn't quite articulate. It's super helpful to have it thoroughly explained all in one spot!

At work we are currently exploring/POCing a migration to RTK to manage state and redux. Something we were planning on doing is converting completely to hooks. This post probably saved us some headache and made me realize that might not be the right move.

1 comments

Heh, you're welcome!

Out of curiosity, what do you mean by "converting completely to hooks" and "not being the right move"?

If you mean "sticking with `connect` for Redux usage in components", we _do_ recommend the hooks API as the default - it's a lot easier to learn and use, especially with TypeScript. Yes, that does mean you don't get the "auto-optimization of re-rendering when parents re-render" that `connect` gives you, but you can get the same result by wrapping your own components in `React.memo()` as needed (which is actually what `connect` uses internally.)