1.1.4 • Published 4 years ago
react-awesome-form-hook v1.1.4
React Awesome Form Hook
The hook makes form usage much easier
Installation
# using npm
npm install react-awesome-form-hook
# using yarn
yarn add react-awesome-form-hook
Example of Usage
Example of Options (in types)
type OptionsValue = {
// required
required: {
value: boolean
message: string
},
// max length
max: {
value: number,
message: string
},
// min length
min: {
value: number,
message: string
},
// pattern
pattern: {
value: RegExp,
message: string
},
// custom function
validate: {
value: (value: string) => boolean,
message: string
}
}
type OptionsValue = {
// required
required: boolean,
// max length
max: number,
// min length
min: number,
// pattern
pattern: RegExp,
// custom function
validate: (value: string) => boolean
}
type Options = {
firstName: CustomInputOptions,
lastName: InputOptions
}