Elements/Button: replace throttle with useThrottledCallback
This commit is contained in:
parent
f57720bf47
commit
253ca05373
@ -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<never> & ElementProps) {
|
||||
const throttledAction = throttle(
|
||||
{
|
||||
interval: 1200,
|
||||
},
|
||||
action
|
||||
);
|
||||
const throttledAction = useThrottledCallback(action, 1200, {
|
||||
trailing: false,
|
||||
});
|
||||
|
||||
return (
|
||||
<AntButton
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user