Skip to content

Commit 378e772

Browse files
committed
examples(filters): debounce global filter input
1 parent 1a3ba61 commit 378e772

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/react/filters/src/main.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ function App() {
105105
return (
106106
<div className="p-2">
107107
<div>
108-
<input
108+
<DebouncedInput
109109
value={globalFilter ?? ''}
110-
onChange={e => setGlobalFilter(e.target.value)}
110+
onChange={value => setGlobalFilter(String(value))}
111111
className="p-2 font-lg shadow border border-block"
112112
placeholder="Search all columns..."
113113
/>
@@ -251,7 +251,7 @@ function DebouncedInput({
251251
value: string | number
252252
onChange: (value: string | number) => void
253253
debounce?: number
254-
} & React.InputHTMLAttributes<HTMLInputElement>) {
254+
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'>) {
255255
const [value, setValue] = React.useState(initialValue)
256256

257257
React.useEffect(() => {

0 commit comments

Comments
 (0)