From 5443b0979eed7e94d7a5a89aa740ac890924970c Mon Sep 17 00:00:00 2001 From: mohiit1502 Date: Wed, 14 Jun 2023 00:15:13 +0530 Subject: [PATCH] Added git related deletions back --- src/app/hooks.ts | 6 ++++++ src/app/store.ts | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/app/hooks.ts create mode 100644 src/app/store.ts diff --git a/src/app/hooks.ts b/src/app/hooks.ts new file mode 100644 index 0000000..d72616b --- /dev/null +++ b/src/app/hooks.ts @@ -0,0 +1,6 @@ +import { TypedUseSelectorHook, useDispatch, useSelector } from "react-redux" +import type { RootState, AppDispatch } from "./store" + +// Use throughout your app instead of plain `useDispatch` and `useSelector` +export const useAppDispatch: () => AppDispatch = useDispatch +export const useAppSelector: TypedUseSelectorHook = useSelector diff --git a/src/app/store.ts b/src/app/store.ts new file mode 100644 index 0000000..c4249ae --- /dev/null +++ b/src/app/store.ts @@ -0,0 +1,17 @@ +import { configureStore, ThunkAction, Action } from "@reduxjs/toolkit" +import counterReducer from "../features/counter/counterSlice" + +export const store = configureStore({ + reducer: { + counter: counterReducer, + }, +}) + +export type AppDispatch = typeof store.dispatch +export type RootState = ReturnType +export type AppThunk = ThunkAction< + ReturnType, + RootState, + unknown, + Action +>