Created
March 1, 2021 21:47
-
-
Save nafeu/3f929e5dfbae353b2d94c32aa0c6b90e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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