You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To create a reducer component extend `ReComponent` from `react-recomponent` instead of `React.Component`.
55
55
56
-
With `ReComponent` state is usually initialized using the `initialState()` callback and can only be modified by sending actions to the `reducer()` function. To help with that, you can use `createSender()`. Take a look at a simple counter example:
56
+
With `ReComponent` state can only be modified by sending actions to the `reducer()` function. To help with that, you can use `createSender()`. Take a look at a simple counter example:
57
57
58
58
```js
59
59
importReactfrom"react";
@@ -63,12 +63,7 @@ class Counter extends ReComponent {
63
63
constructor() {
64
64
super();
65
65
this.handleClick=this.createSender("CLICK");
66
-
}
67
-
68
-
initialState(props) {
69
-
return {
70
-
count:0
71
-
};
66
+
this.state= { count:0 };
72
67
}
73
68
74
69
reducer(action, state) {
@@ -132,12 +127,7 @@ class Counter extends ReComponent {
0 commit comments