React use debounce with setState
问题 Background Assume we all know about the debounce function from lodash . If a user quickly input 1 , 12 , 123 , 1234 , it allows us to proceed an alert only once, with 1234 , after a certain delay time. This is quite used to reduce request amount, for optimization. Description For a normal input field, we can use that kind of debounce and it works. Problem : Once we add a setState inside the same callback with debounce , the debounce won't work as normal. Does anyone know the reason? import