useForm hooks written with Typescript.
npm install @zhyd1997/use-form-hooks
!NPM
!npm (scoped)

> Design useForm hooks and related components.
Demo: CodeSandbox
- Support 4 types of input elements: text, email, password and select;
- Controlled Components;
- Validate form using Constraint Validation API.
``bash`
# using npm
npm install @zhyd1997/use-form-hooks
# or using yarn
yarn add @zhyd1997/use-form-hooks
`jsx
import React from "react";
import { useForm, Form, Select, TextField } from "@zhyd1997/use-form-hooks";
import type { SelectProps, TextFieldProps } from "@zhyd1997/use-form-hooks";
function MyForm() {
const { values, errors, onChange, handleSubmit } = useForm
username: "",
email: "",
role: "",
password: ""
});
const onSubmit = () => {
alert(JSON.stringify(values));
};
return (
Development
When publishing a new release, you must at most do the 2 things below:1. update
version field in package.json.
2. update the version of package used in examples`.