Redux-toolkit helps us to significantly reduce boilerplate in the redux layer of our applications. If you’re not familiar with redux-toolkit you can reference official documentation.

Let create a simple todo reducer:

One downside of this code, is that it’s not possible to reuse types of actions and action payloads setTodoStatus and removeTodo. For example if you need to reuse action type in a middleware handler (e.g. redux-saga). One simple solution would be to extract those as separate types:

However, this once again increases boilerplate. …

Mikhail Boutylin

React / typescript entusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store