Installation
Redux Toolkit
Redux Toolkit includes the Redux core, as well as other key packages we feel are essential for building Redux applications (such as Redux Thunk and Reselect).
It's available as a package on NPM for use with a module bundler or in a Node application:
# NPM
npm install @reduxjs/toolkit
# Yarn
yarn add @reduxjs/toolkit
The package includes a precompiled ESM build that can be used as a <script type="module">
tag directly in the browser.
Complementary Packages
React-Redux
Most likely, you'll also need the react-redux
bindings for use with React
npm install react-redux
Note that unlike Redux itself, many packages in the Redux ecosystem don't provide UMD builds, so we recommend using module bundlers like Vite and Webpack for the most comfortable development experience.
Redux DevTools Extension
Redux Toolkit's configureStore
automatically sets up integration with the Redux DevTools. You'll want to install the browser extensions to view the store state and actions:
- Redux DevTools Extension:
If you're using React, you'll want the React DevTools extension as well:
- React DevTools Extension:
Create a React Redux App
The recommended way to start new apps with React and Redux is by using our official Redux+TS template for Vite, or by creating a new Next.js project using Next's with-redux
template.
Both of these already have Redux Toolkit and React-Redux configured appropriately for that build tool, and come with a small example app that demonstrates how to use several of Redux Toolkit's features.
# Vite with our Redux+TS template
# (using the `degit` tool to clone and extract the template)
npx degit reduxjs/redux-templates/packages/vite-template-redux my-app
# Next.js using the `with-redux` template
npx create-next-app --example with-redux my-app
We do not currently have official React Native templates, but recommend these templates for standard React Native and for Expo:
- https://github.com/rahsheen/react-native-template-redux-typescript
- https://github.com/rahsheen/expo-template-redux-typescript
Redux Core
To install the redux
core package by itself:
# NPM
npm install redux
# Yarn
yarn add redux
If you're not using a bundler, you can access these files on unpkg, download them, or point your package manager to them.