This example shows how to integrate Next.js with Redux Toolkit.
The Redux Toolkit is intended to be the standard way to write Redux logic (create actions and reducers, setup the store with some default middlewares like redux devtools extension). This example demonstrates each of these features with Next.js
Deploy the example using Vercel:
Execute create-next-app
with npm or Yarn to bootstrap the example:
npx create-next-app --example with-redux-toolkit with-redux-toolkit-app
# or
yarn create next-app --example with-redux-toolkit with-redux-toolkit-app
Deploy it to the cloud with Vercel (Documentation).
If you haven't already added TypeScript to your project, follow the steps in the Next.js documentation. If you are new to TypeScript, go through the Next.js learning lesson on TypeScript.
Once TypeScript is added, follow the instructions given on the Redux Toolkit documentation to set up and use Redux Toolkit and React-Redux with TypeScript