Skip to content

[Bug]: 'Fix debouncing ' solution doesn't work #8096

@wolfhoundgelert

Description

@wolfhoundgelert

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions