We need to provide adapters, which make these usage possible:
1. Use v3 state as one field of v2 form state
import * as v2 from 'formstate-x@v2'
import * as v3 from 'formstate-x@v3'
const foo = new v3.FieldState('')
const bar = new v3.FormState({ ... })
new v2.FormState({
foo: v3.toV2(foo),
bar: v3.toV2(bar)
})
2. Use v2 state as one field of v3 form state
import * as v2 from 'formstate-x@v2'
import * as v3 from 'formstate-x@v3'
const foo = new v2.FieldState('')
const bar = new v2.FormState({ ... })
new v3.FormState({
foo: v3.fromV2(foo),
bar: v3.fromV2(bar)
})
This makes it easy for project to migrate from v2 to v3 smoothly.
We need to provide adapters, which make these usage possible:
1. Use v3 state as one field of v2 form state
2. Use v2 state as one field of v3 form state
This makes it easy for project to migrate from v2 to v3 smoothly.