我正在尝试将 Antd Table https://ant.design/components/table/与自定义过滤器和 React Hooks 一起使用。提供的示例中的大部分代码都成功转换为钩子的逻辑,但我不知道如何从代码中转换“this.searchInput”(在下面注释)。
来自 Antd 站点的示例,由我转换为 React Hooks:
import { Table, Input, Button, Space } from 'antd';
import Highlighter from 'react-highlight-words';
import { SearchOutlined } from '@ant-design/icons';
function App() {
const [searchText, setSearchText] = useState('');
const [searchedColumn, setSearchedColumn] = useState('');
const data = [
{
key: '1',
name: 'John Brown',
age: 32,
address: 'New York No. 1 Lake Park',
},
{
key: '2',
name: 'Joe Black',
age: 42,
address: 'London No. 1 Lake …Run Code Online (Sandbox Code Playgroud)