mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 23:16:03 +01:00
perf(web/menu): memoize button and header components
Drops the render times for a 9 button menu down from 12ms to 1.6ms
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Box, Text } from '@chakra-ui/react';
|
||||
import React from 'react';
|
||||
|
||||
const Header: React.FC<{ title: string }> = ({ title }) => {
|
||||
return (
|
||||
@@ -18,4 +19,4 @@ const Header: React.FC<{ title: string }> = ({ title }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default Header;
|
||||
export default React.memo(Header);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Box, Flex, Stack, Text } from '@chakra-ui/react';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { forwardRef } from 'react';
|
||||
import React, { forwardRef } from 'react';
|
||||
import CustomCheckbox from './CustomCheckbox';
|
||||
import type { MenuItem } from './index';
|
||||
|
||||
@@ -68,4 +68,4 @@ const ListItem = forwardRef<Array<HTMLDivElement | null>, Props>(({ item, index,
|
||||
);
|
||||
});
|
||||
|
||||
export default ListItem;
|
||||
export default React.memo(ListItem);
|
||||
|
||||
Reference in New Issue
Block a user