We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c4d81af commit 7eee197Copy full SHA for 7eee197
docs/using-react-redux/static-types.md
@@ -80,6 +80,11 @@ export type AppDispatch = typeof store.dispatch
80
// MyComponent.tsx
81
const dispatch: AppDispatch = useDispatch()
82
```
83
+You may also find it to be more convenient to export a hook like `useAppDispatch` shown below, then using it wherever you'd call `useDispatch`:
84
+```ts
85
+export type AppDispatch = typeof store.dispatch
86
+export const useAppDispatch = () => useDispatch<AppDispatch>() // Export a hook that can be reused to resolve types
87
+```
88
89
### Typing the `connect` higher order component
90
0 commit comments