Skip to content

Commit c0efe9f

Browse files
committed
Update state immutably
1 parent 098c93a commit c0efe9f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/App.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ class App extends Component {
2424
};
2525

2626
deletePersonHandler = ( personIndex ) => {
27-
const persons = this.state.persons;
27+
// const persons = this.state.persons.splice();
28+
const persons = [...this.state.persons];
2829
persons.splice(personIndex, 1);
2930
this.setState({
3031
persons: persons

0 commit comments

Comments
 (0)