Redux To Redux-Toolkit Migration
Redux is a popular third-party library for client-side storage in React JS applications. However, there are some challenges that developers face while implementing Redux in their applications such as :
- “Configuring a Redux store is too complicated”
- “Add a lot of packages to get Redux to do anything useful”
- “Redux requires too much boilerplate code”
To address these concerns, Redux developers created a new package called Redux-Toolkit. In this article, we will learn how a Redux-based application can be migrated to Redux-Toolkit and how it solves some of the above-mentioned challenges.
So let’s get started!!!
1. Installation
The first step is to install the Redux Toolkit package to your app.
While performing the migration you might not need the react-redux package. It could be already there in your app as if you’re already using the standard Redux package. Just make sure it’s the latest version.
npm install @reduxjs/toolkit react-redux
2. Modify the Redux Store
The next step is to look for the existing Redux Store code setup in your app.