From 253ca053736b2871cdaba6111b5851b9bce721cd Mon Sep 17 00:00:00 2001 From: Chika Date: Sun, 18 Sep 2022 13:29:36 +0300 Subject: [PATCH] Elements/Button: replace throttle with useThrottledCallback --- Elements/Button.tsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Elements/Button.tsx b/Elements/Button.tsx index d52a7d1..de63e31 100644 --- a/Elements/Button.tsx +++ b/Elements/Button.tsx @@ -1,7 +1,7 @@ import { Button as AntButton } from 'antd'; import type { BaseButtonProps } from 'antd/lib/button/button'; -import { throttle } from 'radash/dist/curry'; import type { FC } from 'react'; +import { useThrottledCallback } from 'use-debounce'; import type { BaseElementProps } from './types'; type ElementProps = { @@ -17,12 +17,9 @@ export default (function Button({ text, ...props }: BaseElementProps & ElementProps) { - const throttledAction = throttle( - { - interval: 1200, - }, - action - ); + const throttledAction = useThrottledCallback(action, 1200, { + trailing: false, + }); return (