-
Notifications
You must be signed in to change notification settings - Fork 17
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Make reducer an instance method instead of a static method #21
Comments
My initial approach used instance methods for the reducer. You can find some comments about it in #3 I agree that passing of this as the first argument to the side effect is a a bit ugly but that's also what ReactReason ended up doing: https://github.com/reasonml/reason-react/blob/master/docs/state-actions-reducer.md#state-update-through-reducer
I'm not quite sure I understand. When you use React, you don't control what is passed to the constructor - React is calling it for you. |
The ReComponent class is a super class (like react's Component), so the component that extends ReComponent can pass an additional argument to the super constructor
|
this
to the side-effectAlternatively - you can pass the reducer function to the constructor, to make sure that the reducer doesn't have access to the class instance. and this is also more type-safe
The text was updated successfully, but these errors were encountered: