kyk's blog

Redux Typescript

There are two library for redux,

  1. redux-toolkit
  2. create a slice for reducer, action = reducer key name
  3. reduxsauce
  4. normal createActions, createReducer

I recommend redux-toolkit, because it has better support for typescript.
It restrict PayloadAction<SOMETHING> for action creator and reducer.
But the downside is action must be binded to reducer.
Must need to create new action for dispatch two actions.