🔧 chore: usememo dependencies

This commit is contained in:
Andre H 2024-02-22 14:20:26 +07:00
parent bb7a88f7e9
commit c8a153ad27

View File

@ -58,13 +58,16 @@ export const SimpleToast = ({
))} ))}
</div> </div>
) : null, ) : null,
[], [cta],
); );
const renderCloseButton = () => ( const renderCloseButton = useMemo(
<div onClick={() => onDismiss(props.id)} className={closeIconCls()}> () => (
<CrossIcon className="h-3 w-3" /> <div onClick={() => onDismiss(props.id)} className={closeIconCls()}>
</div> <CrossIcon className="h-3 w-3" />
</div>
),
[],
); );
return ( return (
@ -75,7 +78,7 @@ export const SimpleToast = ({
<p className={titleCls()}>{title}</p> <p className={titleCls()}>{title}</p>
</ToastPrimitive.Title> </ToastPrimitive.Title>
{renderCta} {renderCta}
{renderCloseButton()} {renderCloseButton}
</div> </div>
</ToastPrimitive.Root> </ToastPrimitive.Root>
); );