frmx
Version:
Simple, Performant, Lightweight React Forms
30 lines (29 loc) • 1.11 kB
TypeScript
import React from 'react';
export interface FormContextInterface {
disabled: boolean;
formId: string;
handleSubmit(event: React.ChangeEvent<HTMLInputElement>, updatedKeys: string[]): any;
getErrors(): any;
getFields(): object;
getOneField(path: string): any;
getOneUpdated(path: string): any;
getOneError(path: string): boolean;
getUpdatesList(): string[];
hasUpdates(): boolean;
hasErrors(): boolean;
registerFieldObserver(path: string): void;
render: string;
resetForm(): void;
setOneError(path: string, isError: boolean): void;
setOneField(path: string, value: any): void;
setOneUpdated(path: string): void;
unsetOneField(path: string): void;
schemaValidation: object;
}
export declare const FormContext: React.Context<FormContextInterface | null>;
export declare const useForm: () => FormContextInterface | null;
export interface ArrayContextInterface {
validationPath: string;
}
export declare const ArrayContext: React.Context<ArrayContextInterface | null>;
export declare const useArray: () => ArrayContextInterface | null;