Skip to content

Commit a5cf61b

Browse files
authored
Merge pull request #2414 from patel-himanshu/docs/simplify-useappdispatch
Simplify the useAppDispatch definition
2 parents e307245 + f08a9dd commit a5cf61b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docs/tutorials/typescript.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ import type { RootState, AppDispatch } from './store'
8080

8181
// highlight-start
8282
// Use throughout your app instead of plain `useDispatch` and `useSelector`
83-
export const useAppDispatch = () => useDispatch<AppDispatch>()
83+
export const useAppDispatch: () => AppDispatch = useDispatch
8484
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector
8585
// highlight-end
8686
```

docs/usage/usage-with-typescript.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const store = configureStore({
9090

9191
// highlight-start
9292
export type AppDispatch = typeof store.dispatch
93-
export const useAppDispatch = () => useDispatch<AppDispatch>() // Export a hook that can be reused to resolve types
93+
export const useAppDispatch: () => AppDispatch = useDispatch // Export a hook that can be reused to resolve types
9494
// highlight-end
9595

9696
export default store

0 commit comments

Comments
 (0)