Skip to content

Commit

Permalink
use memo
Browse files Browse the repository at this point in the history
  • Loading branch information
reallybeard committed Jan 9, 2024
1 parent 86b3bd1 commit a280a45
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/AssetSelectModal/AssetRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type AssetRowProps = {
export const AssetRow: FC<AssetRowProps> = memo(({ onClick, ...asset }) => {
const [imgLoaded, setImgLoaded] = useState(false)
const { name, icon, symbol, id } = asset
const handleOnClick = useCallback(() => {
const handleClick = useCallback(() => {
onClick(asset)
}, [asset, onClick])

Expand All @@ -29,7 +29,7 @@ export const AssetRow: FC<AssetRowProps> = memo(({ onClick, ...asset }) => {
<Button
width='full'
variant='ghost'
onClick={handleOnClick}
onClick={handleClick}
justifyContent='space-between'
_focus={focus}
height='auto'
Expand Down
2 changes: 1 addition & 1 deletion src/components/AssetSelectModal/AssetSelectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type AssetSelectModalProps = {

export const AssetSelectModal: React.FC<AssetSelectModalProps> = ({ isOpen, onClose, onClick }) => {
const [searchQuery, setSearchQuery] = useState('')
const assets = Object.values(AssetData)
const assets = useMemo(() => Object.values(AssetData), [])
const [activeChain, setActiveChain] = useState<ChainId | 'All'>('All')
const [searchTermAssets, setSearchTermAssets] = useState<Asset[]>([])
const iniitalRef = useRef(null)
Expand Down

0 comments on commit a280a45

Please sign in to comment.