Hacker News new | ask | show | jobs
by acemarke 2751 days ago
Yeah, @tlrobinson linked our issue discussing it.

The big blocker for us shipping a `useRedux()` hook is that there's currently no way for a function component to bail out of re-rendering once it starts, and calling `useContext()` subscribes that function component to _any_ update of the context value. The React team has an issue tracking that (https://github.com/facebook/react/issues/14110 ), and as far as I know that's something they intend to include before 16.7 goes final.

Once that's available, we can look at implementing an official `useRedux()` hook, and ship it in a future release.

That same release would likely also rewrite the guts of `connect` to actually use hooks internally as well. I already threw together a proof-of-concept PR that does this (https://github.com/reduxjs/react-redux/pull/1065 ).