Releases: qiniu/formstate-x
Releases · qiniu/formstate-x
v2.0.0-beta.2
v2.0.0-beta.1
#34 MobX 6.x support
v1.2.0
#28 Provide adapter for formstate
formstate adapter
This module provides a formstate adapter, with which you can use formstate state in formstate-x FormState
like this:
import * as fs from 'formstate'
import { FormState } from 'formstate-x'
// the adapt method
import { xify } from 'formstate-x/esm/adapter'
// formstate FieldState or FormState
const stateA = new fs.FieldState(1)
const stateB = new fs.FormState({ ... })
// formstate-x FormState
const formState = new FormState({
a: xify(state),
b: xify(stateB)
})
// you can use the form state as usual
console.log(formState.value)
const result = await formState.validate()
It is helpful when migrating your project from formstate to formstate-x. Instead of rewriting all your input / field components at once, you can do it one by one. The adapter makes it possible to use formstate-based input / field component in a formstate-x-based form / page component.
NOTE: FormStateLazy
is not supported yet.