improve: improved performance of menu list

This commit is contained in:
Mahyar Khanbolooki
2025-07-07 21:25:18 +03:30
parent a0f0405184
commit 7a69e5fd23
4 changed files with 220 additions and 241 deletions
+15 -7
View File
@@ -1,15 +1,23 @@
import React from 'react';
type Props = {
children: React.ReactNode;
children: React.ReactNode;
} & React.HTMLAttributes<HTMLDivElement>;
function MenuItemRenderer({ children, ...rest }: Props) {
return (
<div {...rest} className={`${rest.className} transition-all duration-200 ease-out w-full h-36 bg-white rounded-3xl px-4 pt-3.5 pb-3 flex justify-between gap-4`}>
{children}
</div>
);
function MenuItemRendererComponent({ children, ...rest }: Props) {
return (
<div
{...rest}
className={`${rest.className} transition-all duration-200 ease-out w-full h-36 bg-white rounded-3xl px-4 pt-3.5 pb-3 flex justify-between gap-4`}
>
{children}
</div>
);
}
// Memoize with shallow comparison of props
const MenuItemRenderer = React.memo(MenuItemRendererComponent, (prevProps, nextProps) => {
return prevProps.className === nextProps.className && prevProps.children === nextProps.children;
});
export default MenuItemRenderer;