realue • Docs
realue / useValidator
useValidator<
T
,N
,E
>(props
,onValidate
?):PromiseState
<E
|undefined
>
Validates the provided value
property using the onValidate
asynchronous callback function.
This function returns a promise state object that tracks the status of the validation process.
The onValidate
callback function is expected to return a value or a promise that resolves with one of the following:
- An error value indicating that validation has failed.
undefined
if the validation succeeds without errors.
• T
• N extends string
• E extends ErrorReportValue
• props: NevoProps
<T
, E
>
Properties according to the NEVO pattern.
• onValidate?: ValueValidator
<T
, E
>
Synchronous or asynchronous value validator.
PromiseState
<E
| undefined
>
The promise state object.
useValidator<
T
,N
,E
>(props
,onValidate
?):PromiseState
<E
|undefined
>
• T extends object
• N extends string
• E extends ErrorReportObject
<T
>
• props: NevoProps
<T
, E
>
• onValidate?: ValueValidator
<T
, E
>
PromiseState
<E
| undefined
>
useValidator<
T
,N
,E
>(props
,onValidate
?):PromiseState
<E
|undefined
>
• T extends unknown
[]
• N extends string
• E extends ErrorReportArray
<T
>
• props: NevoProps
<T
, E
>
• onValidate?: ValueValidator
<T
, E
>
PromiseState
<E
| undefined
>