formhero/examples/select.tsx

33 lines
661 B
TypeScript
Raw Normal View History

2019-09-28 15:20:56 +00:00
import React from 'react'
import { useForm } from '../dist'
2023-01-31 00:26:27 +00:00
import { mount } from './common'
2019-09-28 15:20:56 +00:00
const Index: React.FC = () => {
2023-01-31 00:26:27 +00:00
const { field, form } = useForm({
2019-10-19 06:45:14 +00:00
type: 'formhero',
})
return (
<form
2023-01-31 00:26:27 +00:00
onSubmit={(e) => {
2019-10-19 06:45:14 +00:00
e.preventDefault()
console.log(form)
}}
>
<h1>Select</h1>
<select {...field('type')}>
<option value="redux-form">Redux-Form</option>
<option value="react-hook-forms">React-Hook-Forms</option>
<option value="formik">Formik</option>
<option value="formhero">FormHero</option>
</select>
<input type="submit" />
</form>
)
2019-09-28 15:20:56 +00:00
}
2023-01-31 00:26:27 +00:00
mount(Index)