Skip to content

Commit

Permalink
performance: cache children to improve performance (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
KAROTT7 authored Apr 18, 2022
1 parent 700ce5c commit 5e607ff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,11 @@ const Menu = React.forwardRef<MenuRef, MenuProps>((props, ref) => {
...restProps
} = props as LegacyMenuProps;

const childList: React.ReactElement[] = parseItems(
children,
items,
EMPTY_LIST,
const childList: React.ReactElement[] = React.useMemo(
() => parseItems(children, items, EMPTY_LIST),
[children, items],
);

const [mounted, setMounted] = React.useState(false);

const containerRef = React.useRef<HTMLUListElement>();
Expand Down

0 comments on commit 5e607ff

Please sign in to comment.