Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • 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