{"version":3,"sources":["../../src/use-mounted/index.ts"],"sourcesContent":["import { useRef } from 'react'\nimport { useEffectOnce } from '../use-effect-once'\nimport { useStableFn } from '../use-stable-fn'\n\n/**\n * A React Hook that returns a [Ref Getter](https://sheinsight.github.io/react-use/docs/features/ref-getter/) that indicates whether the component is mounted or not.\n */\nexport function useMounted(): () => boolean {\n  const mountedRef = useRef<boolean>(false)\n\n  useEffectOnce(() => {\n    mountedRef.current = true\n\n    return () => {\n      mountedRef.current = false\n    }\n  })\n\n  return useStableFn(() => mountedRef.current)\n}\n"],"names":["useMounted","mountedRef","useRef","useEffectOnce","current","useStableFn"],"mappings":";;;;+BAOgBA;;;eAAAA;;;qBAPO;6BACO;2BACF;AAKrB,SAASA;IACd,IAAMC,aAAaC,IAAAA,aAAM,EAAU;IAEnCC,IAAAA,4BAAa,EAAC;QACZF,WAAWG,OAAO,GAAG;QAErB,OAAO;YACLH,WAAWG,OAAO,GAAG;QACvB;IACF;IAEA,OAAOC,IAAAA,wBAAW,EAAC;eAAMJ,WAAWG,OAAO;;AAC7C"}