DEV Community

Discussion on: Redux is Dead: Long Live Redux Toolkit

Collapse
 
markerikson profile image
Mark Erikson

I think this is a misunderstanding or mislabeling of "pure functions".

Immer-powered reducers are pure functions. They produce the new state immutably, and they do not actually mutate any values outside the function. It's just that the immutable updates are done via mutating syntax. (And fwiw, Dan Abramov has pointed out just how useful something like Immer is as well.)

I would also argue that createSlice in particular mostly shrinks the Redux API surface, because you're no longer having to write action creators and action types yourself - those now become an implementation detail that you no longer need to worry about.

if you think Redux has a lot of boilerplate, that means your project is too small to benefit from 1 action - many reducers pattern and Redux in general.

as Redux maintainer, I would disagree with this. I've seen thousands of Redux projects of all sizes, and trust me, the "boilerplate" complaints were real. Fortunately, RTK solves them.