{"version":3,"file":"use-throttled-state.mjs","names":[],"sources":["../../src/use-throttled-state/use-throttled-state.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { useThrottledCallbackWithClearTimeout } from '../use-throttled-callback/use-throttled-callback';\n\nexport function useThrottledState<T = any>(defaultValue: T, wait: number) {\n  const [value, setValue] = useState(defaultValue);\n\n  const [setThrottledValue, clearTimeout] = useThrottledCallbackWithClearTimeout(setValue, wait);\n\n  useEffect(() => clearTimeout, []);\n\n  return [value, setThrottledValue] as const;\n}\n"],"mappings":";;;;AAGA,SAAgB,kBAA2B,cAAiB,MAAc;CACxE,MAAM,CAAC,OAAO,YAAY,SAAS,YAAY;CAE/C,MAAM,CAAC,mBAAmB,gBAAgB,qCAAqC,UAAU,IAAI;CAE7F,gBAAgB,cAAc,CAAC,CAAC;CAEhC,OAAO,CAAC,OAAO,iBAAiB;AAClC"}