From f5be16ae32867491ea75fa49022a7f8ef85edfcd Mon Sep 17 00:00:00 2001 From: regexowl Date: Wed, 27 Mar 2024 13:36:04 +0100 Subject: [PATCH] store: Update typed hooks Updated types hooks as per: https://react-redux.js.org/using-react-redux/usage-with-typescript "React Redux v9.1.0 adds a new .withTypes method to each of these hooks, analogous to the .withTypes method found on Redux Toolkit's createAsyncThunk." --- src/store/hooks.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/store/hooks.ts b/src/store/hooks.ts index a1a7827b..2117db80 100644 --- a/src/store/hooks.ts +++ b/src/store/hooks.ts @@ -1,7 +1,7 @@ -import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'; +import { useDispatch, useSelector } from 'react-redux'; import type { RootState, AppDispatch } from './index'; // Use throughout your app instead of plain `useDispatch` and `useSelector` -export const useAppDispatch: () => AppDispatch = useDispatch; -export const useAppSelector: TypedUseSelectorHook = useSelector; +export const useAppDispatch = useDispatch.withTypes(); +export const useAppSelector = useSelector.withTypes();