I started to realize that it just doesn't make a lot of sense. It doesn't actually have a real concept of how to deal with asynchronous things (like, http requests). You have to use weird things like redux-thunk, or god forbid redux-saga.
The event system is basically synchronous, and just changes data which will be displayed in the UI. Why use the event abstraction and all the boilerplate that entails for synchronous code which doesn't really benefit from events? It feels like a cargo cult.
What it boils down to is any function which will at some point change the UI needs to be written weird, so that it takes the "dispatch" function and calls "dispatch(nextFunctionEvent)" instead of "nextFunction()".
Lots of developers always implemented their own half-ass systems to eliminate some boilerplate by automatically defining events from handlers and state or vice versa or some other combination of the above.
React hooks have basically eliminated it's niche, and none to soon!
Oh, please. The projects I've recently worked on used only Hooks instead of Redux. It was a nightmare to deal with. Files with endless amounts of `useSomething`, you'd need to dive through 4 levels of files to get to something useful.
Redux offers a ton of tooling and developer comfort if you get it right. And getting it right means having proper pull request reviews.
There's a lot of developer tooling (debugging tools), too, and a lot of middleware available to plug and play and GO.
If you're just using Hooks and the Reducer and Context APIs you're setting yourself up for a lot of headaches down the road.
Redux already makes use of those technologies, but wraps it in something easy to consume with a LARGE community for support.
Not using Redux is setting yourself up for failure, in my opinion. I've seen it happen too many times in the past year...
Thunks are hardly "weird". The thunk middleware is only about 12 lines long, and it's just a way to let you write arbitrary code that has access to `dispatch` and `getState` without being tied to a specific store instance.
Thunks are our recommended standard way to write async logic in Redux apps [0], and our new official Redux Toolkit package [1] automatically sets up thunks by default as part of the store configuration.
Sagas are incredibly powerful, but most apps don't need them [2]. They're most useful when you need complex "background thread"-like behavior.
And no, Redux is definitely _not_ eliminated or replaced by hooks [3] [4].
The event system is basically synchronous, and just changes data which will be displayed in the UI. Why use the event abstraction and all the boilerplate that entails for synchronous code which doesn't really benefit from events? It feels like a cargo cult.
What it boils down to is any function which will at some point change the UI needs to be written weird, so that it takes the "dispatch" function and calls "dispatch(nextFunctionEvent)" instead of "nextFunction()".
Lots of developers always implemented their own half-ass systems to eliminate some boilerplate by automatically defining events from handlers and state or vice versa or some other combination of the above.
React hooks have basically eliminated it's niche, and none to soon!