Skip to content

Instantly share code, notes, and snippets.

@jokamjohn
Created May 17, 2018 08:36
Show Gist options
  • Save jokamjohn/a19499c7f3223879bfd47b833f1b24ad to your computer and use it in GitHub Desktop.
Save jokamjohn/a19499c7f3223879bfd47b833f1b24ad to your computer and use it in GitHub Desktop.
handleItemUpdate = (event, index) => {
const target = event.target;
const value = target.value;
const name = target.name;
this.setState({
items: this.state.items.map((item, itemIndex) => {
if (itemIndex === index) {
return {
...item,
[name]: value
}
}
return item;
})
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment