🔧 chore: rework usememo logic

This commit is contained in:
Andre H 2024-02-22 14:58:57 +07:00
parent 1cd60d84dd
commit fffc370d40

View File

@ -47,9 +47,9 @@ export const SimpleToast = ({
return <LoadingIcon />; // variant === 'loading' return <LoadingIcon />; // variant === 'loading'
}, [variant]); }, [variant]);
const renderCta = useMemo( const renderCta = useMemo(() => {
() => if (!hasCta) return null;
hasCta ? ( return (
<div className="flex gap-1.5 ml-2"> <div className="flex gap-1.5 ml-2">
{cta.map(({ buttonLabel, ...props }, index) => ( {cta.map(({ buttonLabel, ...props }, index) => (
<Button key={index} {...props}> <Button key={index} {...props}>
@ -57,9 +57,8 @@ export const SimpleToast = ({
</Button> </Button>
))} ))}
</div> </div>
) : null,
[cta],
); );
}, [cta]);
const renderCloseButton = useMemo( const renderCloseButton = useMemo(
() => ( () => (