Closed artistrea closed 1 year ago
Criar uma factory de form, para poder facilmente criar qualquer form sem se importar com a estilização ou html, apenas a lógica. Sendo assim:
Leve em conta e melhore o exemplo do README:
import { FormFactory } from ""; const userSchema = { name: { type: "text", // input type, could be image, etc required: true, }, age: { type: "number", required: true, }, email: { type: "email", required: true, }, password: { type: "password", required: true, customValidation: (formInfo) => formInfo.password.length > 6, }, passwordConfirmation: { type: "password", required: true, customValidation: (formInfo) => formInfo.password === formInfo.passwordConfirmation, }, }; export const UserForm = FormFactory(userSchema);
Objetivo:
Criar uma factory de form, para poder facilmente criar qualquer form sem se importar com a estilização ou html, apenas a lógica. Sendo assim:
Leve em conta e melhore o exemplo do README: