Last active
July 13, 2018 03:08
-
-
Save wootsbot/46dc18b5aed6e9c90b5b5aa298fd2c5b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import {InputText} from 'primereact/inputtext'; | |
import {Button} from 'primereact/button'; | |
class example extends React.Component { | |
this.state = {} | |
inputOnChangeTex(event) { | |
this.setState({[event.target.id]: event.target.value}); | |
} | |
save = () => { | |
const {input1, input2} = this.state | |
const obj = { | |
input1, | |
input2, | |
} | |
// seria igual a | |
/* | |
const obj = { | |
input1: input1, | |
input2: input2, | |
} | |
*/ | |
} | |
render() { | |
const {input1, input2} = this.state | |
return( | |
<> | |
<InputText id="input1" value={input1} onChange={this.inputOnChangeTex} /> | |
<InputText id="input2" value={input2} onChange={this.inputOnChangeTex} /> | |
<Button label="enviar" onClick={this.save}/> | |
</> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment