Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nafeu/3f929e5dfbae353b2d94c32aa0c6b90e to your computer and use it in GitHub Desktop.
Save nafeu/3f929e5dfbae353b2d94c32aa0c6b90e to your computer and use it in GitHub Desktop.
const TWO_HUNDRED_MS = 200;
function GlobalFilter({
preGlobalFilteredRows,
globalFilter,
setGlobalFilter,
}) {
const [value, setValue] = useState(globalFilter);
const onChange = useAsyncDebounce(value => {
setGlobalFilter(value || undefined)
}, TWO_HUNDRED_MS);
return (
<input
value={value || ""}
onChange={e => {
setValue(e.target.value);
onChange(e.target.value);
}}
placeholder={`Search`}
/>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment