import { Col, Row } from "reactstrap";
import React, { useEffect } from "react";
import ValidationField from "../../../Components/ValidationField/ValidationField";
import { useFormikContext } from "formik";
import { useModalState } from "../../../zustand/Modal";

const Form = () => {
  const formik = useFormikContext();
  const { isOpen } = useModalState((state) => state);

  useEffect(() => {
    if (isOpen === "") {
      formik.setErrors({});
      formik.resetForm();
    }
  }, [isOpen]);

  return (
    <Row className="w-100">
      <Col>
        <ValidationField name="name" label="name" />
      </Col>
    </Row>
  );
};

export default Form;
