-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
this.props.dispatch is undefined if using mapDispatchToProps #255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't think it would be better. Indeed, you can bring it back yourself :-). It's just that default |
@gaearon , I'm not sure I quite follow, how do we get dispatch passed into our component that also uses the mapDispatchToProps argument? Thanks! |
Hmm, I think I found a way:
Is this the recommended way to both bind action creators to dispatch as well as get the dispatch function in your component? Thanks! |
@tnrich : yep, that looks correct. My personal opinion is that components generally shouldn't actually reference |
Following tnrich's answer, if I don't use spread operator, and pass dispatch as an argument like this, it still works. Is using a spread operator mandatory here like this? |
Is this on purpose? I know I can bring it back myself but wouldn't it be better if it's attached all the time?
The text was updated successfully, but these errors were encountered: