import { Divider, Input } from 'antd'; import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; export const SelectCollection = ({ value: outValue, onChange }) => { const { t } = useTranslation(); const [value, setValue] = useState(outValue); // 之所以要增加个内部的 value 是为了防止用户输入过快时造成卡顿的问题 useEffect(() => { setValue(outValue); }, [outValue]); return (
{ onChange(e.target.value); setValue(e.target.value); }} />
); };