@undermuz/use-form
Version:
React library for build forms
22 lines (20 loc) • 594 B
TypeScript
interface IActionPayload {
[k: string]: any;
}
interface IAction {
[k: string]: any;
type: string | number;
payload: IActionPayload | any;
}
type DispatchFunction = (action: IAction) => void;
interface IStore<T> {
getState: () => T;
dispatch: DispatchFunction;
}
declare const useReducer: <T>(reducer: (s: T, a: IAction) => T, initialState: T, middlewares?: any[], options?: {
debug?: boolean;
}) => [T, DispatchFunction, {
store: IStore<T>;
reset: () => void;
}];
export { DispatchFunction, IAction, IActionPayload, IStore, useReducer };