mirror of
https://github.com/cupcakearmy/formhero.git
synced 2024-12-22 08:06:24 +00:00
Merge branch 'master' of https://github.com/CupCakeArmy/formhero
This commit is contained in:
commit
cf27d8c77f
40
README.md
40
README.md
@ -10,16 +10,54 @@
|
||||
|
||||
- Typescript compatible
|
||||
- Customizable extractor, validator, getter and setters. (More in the docs)
|
||||
- No Deps
|
||||
- **0** Dependencies
|
||||
- Tiny
|
||||
- React Hooks
|
||||
|
||||
###### Installation
|
||||
|
||||
```
|
||||
npm i formhero
|
||||
```
|
||||
|
||||
## 🚀 Quickstart
|
||||
|
||||
```typescript
|
||||
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({
|
||||
|
Loading…
Reference in New Issue
Block a user