useDebouncedValue

debounce hook

Examples

Basic Usage

This hook allows you to delay reaction to a value change.

// import { useDebouncedValue } from '@octanner/prism-core/hooks';
() => {
const [value, setValue] = React.useState('debounced value');
const debouncedValue = useDebouncedValue(value);
return (
<div>
<TextField label="type here" onChange={(e) => setValue(e.target.value)} />
<Typography>debouncedValue: {debouncedValue}</Typography>
<Typography>value: {value}</Typography>
</div>
);
};