小编use*_*624的帖子

在 Ant 设计 (antd) 表组件中使用带有自定义过滤器的 React Hooks 的 ref

我正在尝试将 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)

reactjs antd react-hooks

9
推荐指数
2
解决办法
6405
查看次数

标签 统计

antd ×1

react-hooks ×1

reactjs ×1