In react-redux8.0.1, what type do I need to give to make my Dispatch error free #1913
Answered
by
markerikson
Silence-dream
asked this question in
Q&A
-
I've implemented a minimal example here I want to make that paragraph disappear, but I don't know how to write What is the proper way to use useDispatch()? |
Beta Was this translation helpful? Give feedback.
Answered by
markerikson
Apr 28, 2022
Replies: 1 comment
-
Follow the TS usage guidelines shown in our docs for inferring the type of |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Silence-dream
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Follow the TS usage guidelines shown in our docs for inferring the type of
dispatch
from your store, and using pre-typed hooks. Also note that the store setup works best if you're using Redux Toolkit'sconfigureStore
(which you should be using anyway):https://react-redux.js.org/using-react-redux/usage-with-typescript#define-root-state-and-dispatch-types