Skip to content

Commit

Permalink
Types
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill-konshin committed Mar 10, 2023
1 parent b13b9df commit 3cbdb53
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Expand Up @@ -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';

Expand All @@ -406,8 +406,13 @@ const makeStore = ({reduxWrapperMiddleware}) =>

export type AppStore = ReturnType<typeof makeStore>;
export type AppState = ReturnType<AppStore['getState']>;
export type AppDispatch = AppStore['dispatch'];
export type AppThunk<ReturnType = void> = ThunkAction<ReturnType, AppState, unknown, Action>;

// Use throughout your app instead of plain `useDispatch` and `useSelector`
export const useAppDispatch = () => useDispatch<AppDispatch>();
export const useAppSelector: TypedUseSelectorHook<AppState> = useSelector;

export const fetchSubject =
(id: any): AppThunk =>
async dispatch => {
Expand Down

0 comments on commit 3cbdb53

Please sign in to comment.