Replies: 1 comment 2 replies
-
There's a useActions recipe in the React Redux docs. It was removed from v7.1.0-alpha.4 based on Dan Abramov's suggestion. Additionally, calling a hook per action needed seems like a lot of inconvenience vs calling useDispatch once and importing the action creators. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey everyone,
I have been using redux for quite some time now and more recently redux toolkit and I really appreciate the auto generated hooks and I was wondering if we could not implement this same functionality for action creators.
I have implemented a minimal example here, I am curious to hear if this is considered a really bad idea or if this was ever considered to be in the RTK library and if so what the decision was around excluding this type of behaviour?
Here is the code snippets in case anyone wants a quicker read:
The above is to generate the hooks and is used like so:
and finally used in a react component in the following way:
Really looking forward to hear any feedback around this!
Beta Was this translation helpful? Give feedback.
All reactions