🦜
Size: a a a
🦜
🦜

🦜
🦜
A
🦜
A
🦜
A
A
const contacts = createForm({email: string(), phone: string()});
const user = createForm({
contacts,
name: string(),
location: { // i am inline form
city: string(),
country: string()
});
user.values.watch(console.log);
contacts.set("email", "blah"); // => {name: "", contacts: {email: "blah", phone: ""}, location: {city: "", country: ""}}
user.set("location", {city: "asd", country: "dsa"}); // => {name: "", contacts: {email: "blah", phone: ""}, location: {city: "asd", country: "dsa"}}
const ContactField = createField(contacts, ({value, onChange, error, validate}) => …)
const UserField = createField(user, ...)
const Email = () => <ContactField name="email" />DS
A
🦜
A
ЕГ
const contacts = createForm({email: string(), phone: string()});
const user = createForm({
contacts,
name: string(),
location: { // i am inline form
city: string(),
country: string()
});
user.values.watch(console.log);
contacts.set("email", "blah"); // => {name: "", contacts: {email: "blah", phone: ""}, location: {city: "", country: ""}}
user.set("location", {city: "asd", country: "dsa"}); // => {name: "", contacts: {email: "blah", phone: ""}, location: {city: "asd", country: "dsa"}}
const ContactField = createField(contacts, ({value, onChange, error, validate}) => …)
const UserField = createField(user, ...)
const Email = () => <ContactField name="email" />A
form.validate()/form.validateField("…") засеттит в стор errors объект той же схемы, но в качестве значений результат валидации, если есть ошибкиЕГ
form.validate()/form.validateField("…") засеттит в стор errors объект той же схемы, но в качестве значений результат валидации, если есть ошибкиvalid: trueЕГ
errors нужно поле isValid, кмкA
valid: trueA
errors нужно поле isValid, кмкisValid = !error