import { useState } from "react"; import { useThrottle, UseThrottleProps } from "hooks"; /** * * @kind 09-Performance */ export const useThrottleState = (initialValue: T, props: UseThrottleProps) => { const { throttle } = useThrottle(props); const [value, setValue] = useState(initialValue); return [value, (newValue: Parameters[0]) => throttle(() => setValue(newValue))] as const; };