@carrot-farm/mongsil-ui
Version:
react ui library
20 lines (19 loc) • 773 B
TypeScript
import { MutableRefObject } from 'react';
import { ValueTypes, Values } from '../types/components';
import { FormContextProps } from '../contexts/formContext';
export declare type FormRef = Pick<FormContextProps, 'values' | 'setValue' | 'setValues'>;
interface UseForm {
/** form 핸들러 등을 가져올 ref */
form: MutableRefObject<FormRef | undefined>;
/** 하나의 값을 셋 */
setValue: (name: string, value: ValueTypes) => void;
/** 여러개의 value를 셋 */
setValues: (values: Values) => void;
/** 하나의 값을 가져옴 */
getValue: (name: string) => ValueTypes;
/** 값을 가져옴 */
getValues: () => ValueTypes | Values;
}
/** ===== Hook ===== */
declare function useForm(): UseForm;
export default useForm;