-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
update counter example to use react-redux v0.5.1 #424
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
update counter example to use react-redux v0.5.1 #424
Conversation
I missed updating the tests, working on them now. |
|
||
class Counter extends Component { | ||
export class CounterComponent extends Component { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep calling it Counter
?
@gaearon Definitely agree with the "smart" and "dumb" component separation. I think this now appears to match your react-redux readme example. Let me know what you think. |
Any specific reason you're putting them in |
It seemed more explicit assigning actions to an actions prop, example. I also didn't want to require an 'Object.Assign' library, but now I realize we could do this instead:
I do like the spread operator for |
This: function mapDispatchToProps(dispatch) {
return {
...bindActionCreators(CounterActions, dispatch)
}
} is exactly equivalent to this: function mapDispatchToProps(dispatch) {
return bindActionCreators(CounterActions, dispatch);
} There is no need for spread here. |
Thank you sir, nice catch. Sounds good. Fixed spreading actions into |
@gaearon Would you like me to resubmit/squash this pull request to a single commit? I realize only |
Yes, please! |
Did you mean to open a new PR? |
I did, #453. I thought it would be easier/cleaner. |
Thanks! |
Update Counter example with most recent react-redux.
Based on reduxjs/react-redux#29.
Remove
CounterApp
component and instead connect to theCounter
component itself.I was also debating using the example with Object.assign, but didn't want to mess with all the different ways to bring that in. Destructuring off actions seems to work alright.
Let me know what you think.