2.0.17 • Published 4 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
8 months ago
1.0.1
8 months ago
1.0.0
8 months ago
1.0.9
8 months ago
1.0.8
8 months ago
1.0.7
8 months ago
1.0.6
8 months ago
1.0.5
8 months ago
1.0.4
8 months ago
2.0.15
4 months ago
2.0.3
8 months ago
2.0.16
4 months ago
2.0.2
8 months ago
2.0.13
4 months ago
2.0.5
8 months ago
2.0.14
4 months ago
2.0.4
8 months ago
2.0.11
4 months ago
2.0.7
4 months ago
2.0.12
4 months ago
2.0.6
6 months ago
2.0.9
4 months ago
2.0.10
4 months ago
2.0.8
4 months ago
2.0.1
8 months ago
2.0.0
8 months ago
2.0.17
4 months ago
1.0.11
8 months ago
1.0.10
8 months ago
1.0.13
8 months ago
1.0.12
8 months ago
0.0.4
9 months ago
0.0.3
9 months ago
0.0.2
9 months ago
0.0.1
9 months ago