我将需要一个服务器端表,所以在我react-table在 github 上看到9k+ 星后决定使用它,我正在尝试构建一个 React-Table,它可以轮询远程服务器的每个请求数据以获取最新数据。所以在示例中,我确实使用了 jsonplaceholder 我请求了数据 func 工作,它将获取我过滤的数据排序pageSize,pageIndex(https://jsonplaceholder.typicode.com/posts?_start={pageIndex will come here}&_limit={pageSize will come here}...排序和过滤的数据)我该怎么做?谢谢你。
下面我写了一些代码但没有很好的编码抱歉
//Table.js
import React, { useState, useEffect } from 'react';
import { useTable, useFilters, useSortBy, usePagination } from 'react-table';
export default function Table({ columns, data, pages, onFetchData, loading, pageCount: controlledPageCount, error }) {
const [ filterInput, setFilterInput ] = useState('');
// Use the state and functions returned from useTable to build your UI
const {
getTableProps,
getTableBodyProps, …Run Code Online (Sandbox Code Playgroud)