This file contains 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
{ | |
"linebreak-style": [ | |
"warn", | |
"unix" | |
], | |
"no-multiple-empty-lines": [ | |
"warn", | |
{ | |
"max": 2, | |
"maxEOF": 1 |
This file contains 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 { withFormik, Form, Field } from 'formik' | |
| |
const MyFormWithFormik = withFormik({ | |
mapPropsToValues: () => ({ | |
email: '', | |
password: '', | |
address: { | |
/* outros campos */ | |
city: { | |
name: '', |
This file contains 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
<Field name='firstName' component={CustomInputComponent} /> | |
| |
const CustomInputComponent = ({ field, …props }) => ( | |
<div> | |
<InputCustom {…field} {…props} /> | |
</div> | |
); | |
// ou | |
<Field | |
name='firstName' |
This file contains 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
class Form extends PureComponent { | |
handleChange = e => { | |
const { name, value } = e.target | |
this.setState({ [name]: value }) | |
} | |
| |
handleChangeNested = e => { | |
const { name, value } = e.target | |
this.setState({ | |
address: { |
This file contains 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
handleChange = e => { | |
const { name, value } = e.target | |
this.setState({ [name]: value }) | |
} | |
| |
const { user } = this.state | |
<Input | |
name='user' | |
value={customer} | |
onChange={this.handleChange} |
This file contains 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 { Input } from 'semantic-ui-react' | |
// Component | |
<Field name='nome' component={FInput} /> | |
const FInput = ({ field, ...props }) => ( | |
<Input {...field} {...props} /> | |
) | |
// Render |
This file contains 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 { Input } from 'semantic-ui-react' | |
<Field name='nome' component={FInput} error={true} options={...} /> | |
const FInput = ({ field, ...props }) => ( | |
<Input {...field} {...props} /> | |
) |
This file contains 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
<Field | |
name='senha' | |
render={({ field }) => ( | |
<Input {...field} error={false} options={...} /> | |
)} | |
/> |
This file contains 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
<Field name='email'> | |
{({ field }) => ( | |
<Input {...field} error={false} options={...} /> | |
)} | |
</Field> |
This file contains 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
<Field | |
name='superHeroi' | |
component={FDropdown} | |
options={options} | |
selection | |
/> |
OlderNewer