import React, { useState } from 'react'; import { Mentions } from 'antd'; import type { MentionsProps } from 'rc-mentions'; const MOCK_DATA = { '@': ['afc163', 'zombiej', 'yesmeck'], '#': ['1.0', '2.0', '3.0'], }; type PrefixType = keyof typeof MOCK_DATA; const App: React.FC = () => { const [prefix, setPrefix] = useState('@'); const onSearch: MentionsProps['onSearch'] = (_, newPrefix) => { setPrefix(newPrefix as PrefixType); }; return ( ({ key: value, value, label: value, }))} /> ); }; export default App;