Skip to content

Commit

Permalink
feat: add typedMemo
Browse files Browse the repository at this point in the history
  • Loading branch information
sashtje committed Sep 28, 2023
1 parent 6e6e658 commit 37a417f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/shared/const/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { memo } from 'react';

export const typedMemo: <T>(c: T) => T = memo;
7 changes: 3 additions & 4 deletions src/shared/ui/Select/ui/Select.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { ChangeEvent, useMemo } from 'react';

import { classNames, Mods } from '@/shared/lib/classNames';
import { typedMemo } from '@/shared/const/common';

import { SelectProps } from '../types';
import cls from './Select.module.scss';

export const Select = <T extends string>(props: SelectProps<T>) => {
export const Select = typedMemo(<T extends string>(props: SelectProps<T>) => {
const {
className,
label,
Expand Down Expand Up @@ -45,6 +46,4 @@ export const Select = <T extends string>(props: SelectProps<T>) => {
</select>
</div>
);
};

Select.displayName = 'Select';
});

0 comments on commit 37a417f

Please sign in to comment.