Creating Reducers with createReducer
Creating reducers with createReducer
Of all Redux main actors,
reducers getS the worst rap. Everyone seems to have something against them. From the widely annoying
switch statements to the immutability constraints you have to employ, it’s easy to see why.
Well, let’s see what RTK’s has to offer to cure some of these woes.
createReducer helper function, as you may have guessed, helps you write reducers with ease. Let’s explore its basic API.
Consider the Flappy reducer: