diff --git a/README.md b/README.md index 85ef8db..d37b63c 100644 --- a/README.md +++ b/README.md @@ -379,7 +379,7 @@ Wrapper has first-class support of `@reduxjs/toolkit`. Full example: https://github.com/kirill-konshin/next-redux-wrapper/blob/master/packages/demo-redux-toolkit. ```ts -import {configureStore, createSlice, ThunkAction} from '@reduxjs/toolkit'; +import {configureStore, createSlice, ThunkAction, TypedUseSelectorHook} from '@reduxjs/toolkit'; import {Action} from 'redux'; import {createWrapper} from 'next-redux-wrapper'; @@ -406,8 +406,13 @@ const makeStore = ({reduxWrapperMiddleware}) => export type AppStore = ReturnType; export type AppState = ReturnType; +export type AppDispatch = AppStore['dispatch']; export type AppThunk = ThunkAction; +// Use throughout your app instead of plain `useDispatch` and `useSelector` +export const useAppDispatch = () => useDispatch(); +export const useAppSelector: TypedUseSelectorHook = useSelector; + export const fetchSubject = (id: any): AppThunk => async dispatch => {