Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react'
- export class Form extends React.PureComponent {
- constructor(props) {
- super(props)
- this.state = {
- input1: null,
- input2: null,
- }
- }
- handleChange(e, key) {
- this.setState({ [key]: e.target.value, })
- }
- render() {
- return (
- <div>
- <input
- onChange={e => this.handleChange(e, 'input1')}
- type={'text'} />
- <input
- onChange={e => this.handleChange(e, 'input2')}
- type={'text'} />
- </div>
- )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement