Redux made easy with Redux Toolkit and Typescript
Using Redux with React can be incredibly challenging for people to get their head around; while the core principles of Redux itself are fairly straightforward and don’t take too long to grasp, a lot of people struggle with using Redux in React apps. Partly because there are so many damn things to integrate:
- React Redux
- Redux Thunk
- Typescript (getting more common in recent years)
- Redux Saga / Redux Observable (in more complex apps)
I spotted this quote which summed it up for me:
Redux was such a mental overhead for me when I started out with it. The amount of boilerplate code that I had to write for the project I worked on was very frustrating.
I struggled with that stuff too, even after I became familiar with the concepts, I often found it difficult to understand the flow of data and events within React Redux apps. This is not uncommon, even the original author of Redux had this to say:
Yup. Can totally relate.
Then I found Redux Toolkit, written by the maintainers of Redux, and recommended by the Redux style guide.