import { createRef } from "react";

type FormEvent = React.FormEvent<HTMLFormElement>;
interface UseFormProps {
  onSubmit: (e: FormEvent) => void;
}
export function useForm(props: UseFormProps) {
  const formRef = createRef<HTMLFormElement>();

  return {
    onSubmit: (e: FormEvent) => {
      e.preventDefault();
      props.onSubmit(e);
    },
    formRef,
  };
}
