Skip to content

Commit

Permalink
minor typo (reduxjs#1950)
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajboruah authored Aug 29, 2022
1 parent 720f0ba commit 31f8b92
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/tutorials/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export type AppDispatch = typeof store.dispatch
### Define Typed Hooks
While it's possible to import the `RootState` and `AppDispatch` types into each component, it's **better to create typed versions of the `useDispatch` and `useSelector` hooks for usage in your application**. . This is important for a couple reasons:
While it's possible to import the `RootState` and `AppDispatch` types into each component, it's **better to create typed versions of the `useDispatch` and `useSelector` hooks for usage in your application**. This is important for a couple reasons:
- For `useSelector`, it saves you the need to type `(state: RootState)` every time
- For `useDispatch`, the default `Dispatch` type does not know about thunks. In order to correctly dispatch thunks, you need to use the specific customized `AppDispatch` type from the store that includes the thunk middleware types, and use that with `useDispatch`. Adding a pre-typed `useDispatch` hook keeps you from forgetting to import `AppDispatch` where it's needed.
Expand Down

0 comments on commit 31f8b92

Please sign in to comment.