From f8f77075ec27de5a0ec9f13cb38ba9ea6af10a47 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Sun, 9 Jan 2022 16:22:04 +0530 Subject: [PATCH] Remove error handling from Avatar component Signed-off-by: Ajay Bura --- src/app/atoms/avatar/Avatar.jsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/app/atoms/avatar/Avatar.jsx b/src/app/atoms/avatar/Avatar.jsx index de1b3fab..59097b5c 100644 --- a/src/app/atoms/avatar/Avatar.jsx +++ b/src/app/atoms/avatar/Avatar.jsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react'; +import React from 'react'; import PropTypes from 'prop-types'; import './Avatar.scss'; @@ -10,22 +10,16 @@ import RawIcon from '../system-icons/RawIcon'; function Avatar({ text, bgColor, iconSrc, iconColor, imageSrc, size, }) { - const [image, updateImage] = useState(imageSrc); let textSize = 's1'; if (size === 'large') textSize = 'h1'; if (size === 'small') textSize = 'b1'; if (size === 'extra-small') textSize = 'b3'; - useEffect(() => { - updateImage(imageSrc); - return () => updateImage(null); - }, [imageSrc]); - return (
{ - image !== null - ? updateImage(null)} alt="avatar" /> + imageSrc !== null + ? avatar : (