🔧 chore: remove useMemo

This commit is contained in:
Andre H 2024-02-29 13:58:45 +07:00
parent 638e31f7fe
commit dfa38a4cba

View File

@ -1,4 +1,4 @@
import React, { forwardRef, ComponentPropsWithoutRef, useMemo } from 'react'; import React, { forwardRef, ComponentPropsWithoutRef } from 'react';
import { Overwrite, UseComboboxGetItemPropsReturnValue } from 'downshift'; import { Overwrite, UseComboboxGetItemPropsReturnValue } from 'downshift';
import { import {
userSelectItemTheme, userSelectItemTheme,
@ -34,11 +34,6 @@ const UserSelectItem = forwardRef<HTMLLIElement, UserSelectItemProps>(
const { value, label, imgSrc = './logo.svg' } = option; const { value, label, imgSrc = './logo.svg' } = option;
const renderLeftImage = useMemo(
() => <img src={imgSrc} alt={`${value}-logo`} className={theme.img()} />,
[imgSrc, value],
);
return ( return (
<li <li
{...props} {...props}
@ -46,7 +41,7 @@ const UserSelectItem = forwardRef<HTMLLIElement, UserSelectItemProps>(
className={theme.wrapper({ className, active: selected || hovered })} className={theme.wrapper({ className, active: selected || hovered })}
> >
<div className={theme.content()}> <div className={theme.content()}>
{renderLeftImage} <img src={imgSrc} alt={`${value}-logo`} className={theme.img()} />
<p className={theme.label()}>{label}</p> <p className={theme.label()}>{label}</p>
</div> </div>
{selected && <CheckRadioIcon className={theme.selectedIcon()} />} {selected && <CheckRadioIcon className={theme.selectedIcon()} />}