Skip to content
This repository was archived by the owner on May 15, 2022. It is now read-only.

Commit 61ed66b

Browse files
authored
Update example code in README.md
1 parent afba94b commit 61ed66b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ class App extends React.Component {
5151
}
5252
}
5353

54-
handleUpdate = data => this.setState({ data })
54+
// Update current state with changes from controls
55+
handleUpdate = newData =>
56+
this.setState(prevState => ({
57+
data: { ...prevState.data, ...newData }
58+
}));
5559

5660
render() {
5761
const { data } = this.state;

0 commit comments

Comments
 (0)