from Hacker News

React Hook for Redux

by wingspan on 10/26/18, 4:15 PM with 1 comments

  • by acemarke on 10/26/18, 4:41 PM

    Hi, I'm a Redux maintainer. I'm already trying to think of ways to make use of hooks with React-Redux. We've been working on React-Redux v6, and have a couple WIP PRs that we've been comparing. Yesterday, I took my PR at https://github.com/reduxjs/react-redux/pull/995, and updated it locally to use hooks instead of class components. Looks great so far, and I hope to push that up in the next day or two.

    Based on that, I'm also starting to think about how we might have a `useRedux` hook as part of v6. Tim already filed an issue at https://github.com/reduxjs/react-redux/issues/1063 for discussion.

    However, in v6, we're switching from putting the _store_ into legacy context, to putting the _store state_ into new context. This actually brings up an issue with hooks - see the thread at https://twitter.com/acemarke/status/1055694323847651335 for discussion with the React team. So, hopefully we'll be able to do that performantly by the time that React 16.7 comes out.