Created
March 31, 2020 11:08
-
-
Save dandelionadia/d38845138e67164e99a7f803abc5f208 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
state = { | |
persons: [ | |
{ id: 'asfa1', name: 'Max', age: 28 }, | |
{ id: 'vasdf1', name: 'Manu', age: 29 }, | |
{ id: 'asdf11', name: 'Stephanie', age: 26 } | |
], | |
otherState: 'some other value', | |
showPersons: false, | |
showCockpit: true, | |
changeCounter: 0 | |
}; | |
_____________________ | |
nameChangedHandler = (event, id) => { | |
... | |
this.setState((prevState, props) => { | |
return { | |
persons: persons, | |
changeCounter: prevState.changeCounter + 1 | |
}; | |
}); | |
}; | |
_________________ | |
<Persons | |
persons={this.state.persons} | |
clicked={this.deletePersonHandler} | |
changed={this.nameChangedHandler} | |
/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment