UNPKG

beautiful-react-hooks

Version:

A collection of beautiful (and hopefully useful) React hooks to speed-up your components and hooks development

10 lines (9 loc) 398 B
export interface ValidationResult { changed: boolean; valid?: boolean; } /** * Returns a state that changes only if the next value pass its validator */ declare const useValidatedState: <TValue, TValidator extends (value: TValue) => boolean>(validator: TValidator, initialValue?: TValue) => (ValidationResult | TValue | ((nextValue: TValue) => void))[]; export default useValidatedState;