19 lines
431 B
TypeScript
19 lines
431 B
TypeScript
import type { SelectProps } from 'antd';
|
||
import { Select as AntSelect } from 'antd';
|
||
import { useMemo } from 'react';
|
||
|
||
export function Select({ options = [], ...props }: SelectProps<string | null>) {
|
||
const optionsWithNull = useMemo(
|
||
() => [
|
||
{
|
||
label: 'Не выбрано',
|
||
value: null,
|
||
},
|
||
...options,
|
||
],
|
||
[options]
|
||
);
|
||
|
||
return <AntSelect options={optionsWithNull} {...props} />;
|
||
}
|