We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0ed150d commit 806bd38Copy full SHA for 806bd38
src/components/patterns/StateReducer/exercise_2/Field.jsx
@@ -14,19 +14,21 @@ export class Field extends React.Component {
14
15
onChange = e => {
16
const { stateReducer } = this.props;
17
- const { state } = this.state;
+ const { value } = e.target;
18
19
- this.setState(
20
- stateReducer(state, { type: ON_FIELD_CHANGE, value: e.target.value })
+ this.setState(state =>
+ stateReducer(state, { type: ON_FIELD_CHANGE, value })
21
);
22
};
23
24
onReset = e => {
25
26
27
28
29
- stateReducer(state, { type: ON_FIELD_RESET, value: this.initialState })
+ stateReducer(state, {
+ type: ON_FIELD_RESET,
30
+ value: this.initialState.value
31
+ })
32
33
34
0 commit comments