Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. import React from 'react'
  2.  
  3. export class Form extends React.PureComponent {
  4. constructor(props) {
  5. super(props)
  6. this.state = {
  7. input1: null,
  8. input2: null,
  9. }
  10. }
  11.  
  12. handleChange(e, key) {
  13. this.setState({ [key]: e.target.value, })
  14. }
  15.  
  16. render() {
  17. return (
  18. <div>
  19. <input
  20. onChange={e => this.handleChange(e, 'input1')}
  21. type={'text'} />
  22. <input
  23. onChange={e => this.handleChange(e, 'input2')}
  24. type={'text'} />
  25. </div>
  26. )
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement