Advertisement
Guest User

Untitled

a guest
Apr 27th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. /**
  2. *
  3. * We took 28 lines of code and made it into 3 lines of code by realizing that we were
  4. * doing the exact same command just on different things. And since we already had the
  5. * event being passed, we could grab the name of the event.target and use that inside of state!
  6. *
  7. */
  8.  
  9. handleFormChange(e) {
  10. this.setState({form: {...this.state.form, [e.target.name]: e.target.value}});
  11. }
  12.  
  13. // handleUsernameChange(e){
  14. // console.log(e.target.name);
  15. // this.setState({form: {...this.state.form, username: e.target.value}});
  16. // this.showStateChange();
  17. // }
  18. // handleEmailChange(e){
  19. // this.setState({form: {...this.state.form, email: e.target.value}});
  20. // }
  21. //
  22. // handlePasswordChange(e){
  23. // this.setState({form: {...this.state.form, password: e.target.value}});
  24. // }
  25. //
  26. // handleNameChange(e){
  27. // this.setState({form: {...this.state.form, fullName: e.target.value}});
  28. // }
  29. // handleAddressChange(e){
  30. // this.setState({form: {...this.state.form, address: e.target.value}})
  31. // this.showStateChange();
  32. // }
  33. // handleCityStateChange(e){
  34. // this.setState({form: {...this.state.form, cityState: e.target.value}});
  35. // this.showStateChange();
  36. // }
  37. // handleZipChange(e){
  38. // this.setState({form: {...this.state.form, cityState: e.target.value}});
  39. // this.showStateChange();
  40. // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement