feat(ui): more memoization

This commit is contained in:
psychedelicious
2023-12-29 18:37:14 +11:00
committed by Kent Keirsey
parent 3e6173ee8c
commit 2d96c62fdb
49 changed files with 215 additions and 131 deletions

View File

@ -5,10 +5,10 @@ import type { InvLabelProps } from 'common/components/InvControl/types';
import { InvSwitch } from 'common/components/InvSwitch/wrapper';
import { setHrfEnabled } from 'features/hrf/store/hrfSlice';
import type { ChangeEvent } from 'react';
import { useCallback } from 'react';
import { memo, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
export default function ParamHrfToggle() {
const ParamHrfToggle = () => {
const dispatch = useAppDispatch();
const { t } = useTranslation();
@ -21,14 +21,12 @@ export default function ParamHrfToggle() {
);
return (
<InvControl
label={t('hrf.enableHrf')}
labelProps={labelProps}
w="full"
>
<InvControl label={t('hrf.enableHrf')} labelProps={labelProps} w="full">
<InvSwitch isChecked={hrfEnabled} onChange={handleHrfEnabled} />
</InvControl>
);
}
};
const labelProps: InvLabelProps = { flexGrow: 1 };
const labelProps: InvLabelProps = { flexGrow: 1 };
export default memo(ParamHrfToggle);