Not in particular. I never came across the docs for mapDispatch, so I didn't know of its existence. I also didn't see it before in projects that I either worked on or contributed to, so that didn't help either.
I consciously decided to illustrate the function form, because I feel like it better describes what mapDispatch is and what its purpose is. But I definitely like the object shorthand!
While looking into mapDispatch after the first time I learned about it, I also came across useDispatch. I haven't read the links that you mentioned yet (but definitely will do!), but I personally rather stick with the HOC construction. It keeps class and function components interchangeable (at my job we use class components) and I feel like using useDispatch is very similar to just connecting a component and calling the dispatch function, which kind of equals not using mapDispatch. I prefer the explicitness the HOC approach provides in tests and how easy it becomes to validate them.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Not in particular. I never came across the docs for
mapDispatch
, so I didn't know of its existence. I also didn't see it before in projects that I either worked on or contributed to, so that didn't help either.I consciously decided to illustrate the function form, because I feel like it better describes what mapDispatch is and what its purpose is. But I definitely like the object shorthand!
While looking into
mapDispatch
after the first time I learned about it, I also came acrossuseDispatch
. I haven't read the links that you mentioned yet (but definitely will do!), but I personally rather stick with the HOC construction. It keeps class and function components interchangeable (at my job we use class components) and I feel like usinguseDispatch
is very similar to just connecting a component and calling the dispatch function, which kind of equals not usingmapDispatch
. I prefer the explicitness the HOC approach provides in tests and how easy it becomes to validate them.