-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
Summary
https://react.dev/learn/referencing-values-with-refs#fix-debouncing --> Solution --> Try provided solution: Only the last button handler fires after debouncing.
Page
https://react.dev/learn/referencing-values-with-refs#fix-debouncing
Details
https://react.dev/learn/referencing-values-with-refs#fix-debouncing --> Solution --> Try provided solution: Only the last button handler fires after debouncing.
The solution via using useRef doesn't work and has the same issue as in the challenge description: "This example works, but not quite as intended. The buttons are not independent. To see the problem, click one of the buttons, and then immediately click another button. You’d expect that after a delay, you would see both button’s messages. But only the last button’s message shows up. The first button’s message gets lost."
Only the last button handler fires after debouncing.
Checked on:
Win11, Chrome Version 141.0.7390.123 (Official Build) (64-bit)