Guest User

Untitled

a guest
May 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. handleItemUpdate = (event, index) => {
  2. const target = event.target;
  3. const value = target.value;
  4. const name = target.name;
  5. this.setState({
  6. items: this.state.items.map((item, itemIndex) => {
  7. if (itemIndex === index) {
  8. return {
  9. ...item,
  10. [name]: value
  11. }
  12. }
  13. return item;
  14. })
  15. });
  16. };
Add Comment
Please, Sign In to add comment