1.0.0 • Published 9 months ago
antd-form-helpers v1.0.0
antd-form-helpers
To start using:
yarn add antd-form-helpers
Examples:
Base: useFormValidation:
const LoginFormComponent: React.FC<AllProps> = props => {
const { authModel } = props;
const { fields } = useFormValidation(['email', 'password'], authModel.params, authModel.errors);
...
return (
<Form onFinish={login} fields={fields}>
With model IUpdateModel\: useUpdateFormValidation:
import { useUpdateFormValidation } from 'antd-form-helpers';
const CompanyUpdateFormComponent: React.FC<AllProps> = props => {
const { itemModel, companyModel } = props;
const { fields } = useUpdateFormValidation(
['name', 'domain', 'maxEmployees'],
companyModel.params,
companyModel.errors,
itemModel
);
...
return (
<Form onFinish={updateCompany} fields={fields}>
1.0.0
9 months ago