It's really only two lines: adding the slice reducer, and adding the middleware.
I'm curious, what about that aspect feels "intimidating"? I would think that the middleware setup in particular is less confusing than having to use applyMiddleware + compose with vanilla Redux.
And yes, a reducer function is just a function, and you can absolutely use reducers from createReducer/createSlice with React's useReducer hook. I've done it frequently, including in apps that weren't using a Redux store at all, because I wanted to write some complex reducers with good TS typing.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hmm. Yeah, I left out the store setup piece, but that's trivial:
It's really only two lines: adding the slice reducer, and adding the middleware.
I'm curious, what about that aspect feels "intimidating"? I would think that the middleware setup in particular is less confusing than having to use
applyMiddleware
+compose
with vanilla Redux.And yes, a reducer function is just a function, and you can absolutely use reducers from
createReducer/createSlice
with React'suseReducer
hook. I've done it frequently, including in apps that weren't using a Redux store at all, because I wanted to write some complex reducers with good TS typing.