2.0.17 • Published 5 months ago
mobx-react-hook-form v2.0.17
mobx-react-hook-form
Simple react-hook-form wrapper for MobX.
Usage
import { reaction } from "mobx"
import { MobxForm } from "mobx-react-hook-form"
class YourVM {
form = new MobxForm({
disposer?: this.disposer,
resolver: valibotResolver(
v.object({
username: v.string('This field is required')
})
),
onSubmit: ({ username }) => {
console.info("nick username", username);
},
onSubmitFailed: () => {
//
},
onReset: () => {
//
}
})
mount(){
reaction(
() => this.form.data?.username,
(username) => {
//
}
)
}
}
const YourView = () => {
const form = useMobxForm(yourVM.form)
return (
<form onSubmit={form.onSubmit} onReset={form.onReset}>
<Controller control={form.control} name={'username'} render={...} />
</form>
)
}
1.0.2
9 months ago
1.0.1
9 months ago
1.0.0
9 months ago
1.0.9
9 months ago
1.0.8
9 months ago
1.0.7
9 months ago
1.0.6
9 months ago
1.0.5
9 months ago
1.0.4
9 months ago
2.0.15
5 months ago
2.0.3
9 months ago
2.0.16
5 months ago
2.0.2
9 months ago
2.0.13
5 months ago
2.0.5
9 months ago
2.0.14
5 months ago
2.0.4
9 months ago
2.0.11
5 months ago
2.0.7
5 months ago
2.0.12
5 months ago
2.0.6
7 months ago
2.0.9
5 months ago
2.0.10
5 months ago
2.0.8
5 months ago
2.0.1
9 months ago
2.0.0
9 months ago
2.0.17
5 months ago
1.0.11
9 months ago
1.0.10
9 months ago
1.0.13
9 months ago
1.0.12
9 months ago
0.0.4
10 months ago
0.0.3
10 months ago
0.0.2
10 months ago
0.0.1
10 months ago