-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Alireza Hooshyar edited this page Mar 30, 2020
·
4 revisions
Welcome to the react-easy-fields wiki!
Step 1: Form Fields
const fields = [
{
label: 'First Name',
id: 'first_name'
},
{
label: 'Bio',
id: 'bio',
htmltype: 'textarea'
},
{
label: 'Gender',
id: 'gender',
htmltype: 'radio',
items: ['Men', 'Women']
},
{
label: 'I\'m agree to terms ',
id: 'agree',
htmltype: 'checkbox'
},
{
label: 'Country',
id: 'country',
htmltype: 'related',
items: [
{
label: 'Iran',
value: 1
},
{
label: 'USA',
value: 2
}
]
}
]
Step 2: Submit Function
const handleSubmit = data => {
// Api Implementation
console.log(data);
}
Step 3: Enjoy
<h1>React Easy Fields</h1>
<DynamicForm fields={fields} onSubmit={handleSubmit} />