Skip to content

Deprecate useDebounce and useThrottle in favor of the Callback hooks #537

Description

@hyesungoh

useDebounce and useThrottle return a wrapped function, but the names do not say so, and other hook libraries use the same names for hooks that return a debounced or throttled value. useDebouncedCallback and useThrottledCallback cannot replace them yet, because they forward a single value and have no cancel.

  • Let useDebouncedCallback and useThrottledCallback wrap a function with any arguments and return it with cancel.
  • Mark useDebounce and useThrottle as deprecated and point their docs to the Callback hooks.
  • useImpressionRef relies on the Callback hook skipping a repeated call with the same value. Keep that behavior, either in the Callback hook or in useImpressionRef.

Update types, docs, and tests.

Waits for #530 and #534.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions