Rasmus Olsson

Redux toolkit the new standard

October 14, 2020

As a developer, we regularly read and learn about new frameworks. We read the API documentation and start implementing. After that or in the best case before we even start, we discuss the implementation plan with the team. Some questions that maybe be raised:

  • Where should we put the logic
  • Should we normalize the data
  • What naming convention should we use
  • Should we use tabs or spaces…?

If you’ve done Redux before you might have come across the Redux style guide. The style guide is a set of best practices and conversions on how to use Redux. It helps us as developers to come to a convention that is opinionated by the developer of Redux. It helps us come together, clear out unknowns and liking, and produce good code faster.

Redux toolkit is such a guideline, even if it’s not directly part of the “Redux” style guide documentation, it’s still something that the creator of Redux opinionated.

Redux Toolkit our official, opinionated, batteries-included toolset for efficient Redux development. It is intended to be the standard way to write Redux logic, and we strongly recommend that you use it.

The Redux Toolkit contains utilities and defaults that we usually use in our setup of Redux. For example, including Redux DevTools during store setup and redux thunk out of the box.

It also comes with great utility functions such as CreateSlice which helps export reducer and action creators with implicit type names which reducing the boiler-plating that Redux can be famous for.

The Redux Toolkit is designed with openness and flexibility in mind and can be customized in various ways to handle advanced scenarios while still proving default and best practices of Redux, directly inside the framework itself.

If you haven’t checked out The Redux Toolkit, I highly recommend going through the tutorial, link provided below.

https://redux-toolkit.js.org/tutorials/basic-tutorial

Happy coding!

please share