mirror of
https://github.com/cupcakearmy/formhero.git
synced 2024-12-22 16:16:24 +00:00
Update README.md
This commit is contained in:
parent
a34f11103b
commit
69d8c7fd3c
32
README.md
32
README.md
@ -20,6 +20,38 @@
|
|||||||
import ReactDOM from 'react-dom'
|
import ReactDOM from 'react-dom'
|
||||||
import { useForm } from 'formhero'
|
import { useForm } from 'formhero'
|
||||||
|
|
||||||
|
const Form = () => {
|
||||||
|
|
||||||
|
const { auto, form } = useForm({
|
||||||
|
username: '',
|
||||||
|
password: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
const _submit = (e: React.FormEvent) => {
|
||||||
|
e.preventDefault()
|
||||||
|
console.log(form)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<form onSubmit={_submit}>
|
||||||
|
|
||||||
|
<input {...auto('username')} />
|
||||||
|
<input {...auto('password')} />
|
||||||
|
|
||||||
|
<button type="submit">Go 🚀</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🔥 Avanced Example
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import ReactDOM from 'react-dom'
|
||||||
|
import { useForm } from 'formhero'
|
||||||
|
|
||||||
const Form = () => {
|
const Form = () => {
|
||||||
|
|
||||||
const { auto, form, errors } = useForm({
|
const { auto, form, errors } = useForm({
|
||||||
|
Loading…
Reference in New Issue
Block a user