import { ReactNode } from 'react';
// form
import { FormProvider as Form, UseFormReturn } from 'react-hook-form';

// ----------------------------------------------------------------------

type Props = {
  children: ReactNode;
  methods: UseFormReturn<any>;
  onSubmit?: VoidFunction;
  encType?: string;
};

export default function FormProvider({ children, onSubmit, methods, encType }: Props) {
  return (
    <Form {...methods}>
      <form onSubmit={onSubmit} encType={encType}>
        {children}
      </form>
    </Form>
  );
}
