front-end/src/layout/ErrorAlert.js
/**
 * Defines the alert message to render if the specified error is truthy.
 * @param error
 *  an instance of an object with `.message` property as a string, typically an Error instance.
 * @returns {JSX.Element}
 *  a bootstrap danger alert that contains the message string.
 */
Defines the alert message to render if the specified error is truthy.
@param error
an instance of an object with `.message` property as a string, typically an Error instance.
@returns {JSX.Element}
a bootstrap danger alert that contains the message string.
Defines the alert message to render if the specified error is truthy . @param error an instance of an object with ` . message ` property as a string typically an Error instance . @returns { JSX . Element } a bootstrap danger alert that contains the message string .
function ErrorAlert({ error }) {
  let elements = error.map((err, index) => 
    (
      <div key={index} className="alert alert-danger m-2">Error: {err.message}</div>
    )
  )
  return (
    error && elements
  );
}
function ErrorAlert ( { error } ) { let elements = error . map ( ( err , index ) => ( < div key = { index } className = "alert alert-danger m-2" > Error:  { err . message } < / div > ) ) return ( error && elements ) ; }
Defines the alert message to render if the specified error is truthy.
Defines the alert message to render if the specified error is truthy .