- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
const price = Number(event.target.value);
setPrice(price);
if (timer) {
clearTimeout(timer);
setTimer(null);
}
const validPrice = validatePrice(price);
if (event.target.id.includes("cause")) {
handleOnChange(validPrice);
} else {
const timerId: any = setTimeout(() => {
setPrice(validPrice);
handleOnChange(validPrice);
}, 1000);
setTimer(timerId);
}
};