rehance-forms
Version:
Form utilities for React
29 lines (28 loc) • 737 B
TypeScript
import { IScopeChild } from "./types";
export declare class FieldContext implements IScopeChild {
private _initialValue;
value: any;
error: string | null;
touched: boolean;
constructor(initialValue?: any);
/**
* Returns true if the field does not have an error.
*/
readonly valid: boolean;
/**
* Returns true if the value for the field has changed.
*/
readonly changed: boolean;
/**
* Resets the value for the current field back to its initial value.
*/
reset(): void;
/**
* Clears the value for the current field.
*/
clear(): void;
/**
* Replaces the `initialValue` of the field with the current `value`.
*/
commit(): void;
}