import React from 'react';
import { useStyles } from './styles/error';
import { getErrorMessage } from 'utils/get-error-message';

interface ErrorProps {
  children: string;
}

export const Error: React.FC<ErrorProps> = ({ children }) => {
  const classes = useStyles();
  return <span className={classes.error}>{getErrorMessage(children)}</span>;
};
