How to use the react-table.useAsyncDebounce function in react-table

To help you get started, we’ve selected a few react-table examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kalmhq / kalm / frontend / src / widgets / KRTable.tsx View on Github external
const GlobalFilter = ({ preGlobalFilteredRows, globalFilter, setGlobalFilter }: any) => {
  const [value, setValue] = React.useState(globalFilter);

  if (!globalFilter && value) {
    setGlobalFilter(value);
  }

  const onChange = useAsyncDebounce((value) => {
    setGlobalFilter(value || undefined);
  }, 200);

  return (
    
       {
          setValue(e.target.value);
          onChange(e.target.value);
        }}
        placeholder="Filter"
      />