Update README.md

This commit is contained in:
Nicco 2019-09-27 14:33:15 +02:00 committed by GitHub
parent a34f11103b
commit 69d8c7fd3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,38 @@
import ReactDOM from 'react-dom'
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 { auto, form, errors } = useForm({