xnimorz/use-debounce

How to wait for the new value

Closed this issue · 2 comments

Hey i wanted to handle user input from a textarea, but if the user submit the form before the debounce the previouse value is taken. How can i wait for the value to change then submit my form ?

Can someone help me ?

Hi @MatteoGauthier
You do not need to wait for debounceCallback, you could save both original and denounce values:
https://codesandbox.io/s/callback-forked-j5dt5
Hence you could provide the interface with 2 values and use the original value for the form submitting

@xnimorz Thanks for your reply, i did not understand that the debounce utility is used for the UI. Thanks it's more clear now.