Lesson 31 of 56
TypescriptRedux Toolkit + TypeScript
25 minutes
Course progress55%
Installing
npm i @reduxjs/toolkit react-redux
npm i -D @types/react-redux
Slice with Types
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
type CounterState = { value: };
: = { : };
counterSlice = ({
: ,
initialState,
: {
() { state.++; },
() { state. += action.; }
}
});
{ increment, add } = counterSlice.;
counterSlice.;