You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ErrorMessage.js 877B

1234567891011121314151617181920212223242526272829
  1. import React from "react";
  2. import PropTypes from "prop-types";
  3. import { ErrorMessage as ErrorMessageContainer } from "../../FirstPart/FirstPartOfRegistration.styled";
  4. const ErrorMessage = (props) => {
  5. const formik = props.formik;
  6. return (
  7. <>
  8. {formik.errors?.location && formik.touched?.location ? (
  9. <ErrorMessageContainer>{formik.errors.location}</ErrorMessageContainer>
  10. ) : formik.errors?.phoneNumber && formik.touched?.phoneNumber ? (
  11. <ErrorMessageContainer>
  12. {formik.errors.phoneNumber}
  13. </ErrorMessageContainer>
  14. ) : formik.errors?.website && formik.touched?.website ? (
  15. <ErrorMessageContainer>{formik.errors.website}</ErrorMessageContainer>
  16. ) : (
  17. <></>
  18. )}
  19. </>
  20. );
  21. };
  22. ErrorMessage.propTypes = {
  23. children: PropTypes.node,
  24. formik: PropTypes.any,
  25. };
  26. export default ErrorMessage;