useDebounce

パフォーマンスを最適化するために、急速に変化する値を遅延させます。


import { useDebounce } from 'primereact/hooks';
         

キーストローク間の時間が 400ms を超えた場合にのみ、値が反映されます。

ディバウンスされた値:

<InputText type="text" value={inputValue} onChange={(e) => setInputValue(e.target.value)} />
<span className="text-xl">
    Debounced Value: <strong>{debouncedValue}</strong>
</span>