10

Me: Oh, man, there are hooks for react-redux now? I don’t have to wrap components in a higher order component to get information from the redux store and dispatch actions? Could this solve the problem I’m having with data fetching and consistency in the app I’m working on?!

Spends entire Saturday writing a basic server, connecting to an mLab instance, filling said instance with dummy data, starting a create-react-app, writing a reducer, action creators, components, etc. just to test how useSelector(), useEffect(), and useDispatch() would work in an application that isn’t just a simple counter (why is it that like every example is always the counter example?!). Bonus, react-router now ALSO has hooks, so got to play with useHistory() and useParams()

Conclusion: Maybe. It does appeal to me to not have the cascade of virtual DOM that you always get nesting HOCs, but I’m also wary of appearing too willing to jump on it just because it’s the new thing.

Has anybody else played around with react-redux hooks? Your thoughts?

Also, yes, I know, not every app needs redux. It had it when I was brought on and I don’t really have the ability to change that implementation detail now.

Comments
  • 0
    since hooks has been a thing, i honestly struggle to see any value provided to us by redux other than extra dependency to maintain and extra boilerplate

    creating a pub/sub-ish state manager is a child play, it goes well with typescript, memoized selectors are simple to test and implement... what else do i need?
  • 0
    I replaced redux in a reactjs app with pub/sub with a backend php server that stored stuff in &_SESSION
    Lol dont kill me
    But it works !
  • 1
    The good thing about the current redux is I can dispatch without the needs to use connect()
Add Comment