{"version":3,"file":"useBeforeMount.cjs","names":[],"sources":["../../src/useBeforeMount/useBeforeMount.ts"],"sourcesContent":["import { useRef } from 'react';\n\n/**\n * Runs a function once during the component's first render.\n *\n * This hook is useful for synchronous setup that must be available before the\n * initial React commit. It intentionally does not run again on re-render.\n *\n * @param fn - Function to run once before mount.\n *\n * @example\n * ```tsx\n * useBeforeMount(() => {\n *   registry.register(id);\n * });\n * ```\n */\nexport const useBeforeMount = (fn: () => void): void => {\n  const isFunctionCalled = useRef(false);\n\n  if (!isFunctionCalled.current) {\n    fn();\n    isFunctionCalled.current = true;\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,kBAAkB,OAAyB;CACtD,MAAM,oBAAA,GAAA,MAAA,OAAA,CAA0B,KAAK;CAErC,IAAI,CAAC,iBAAiB,SAAS;EAC7B,GAAG;EACH,iBAAiB,UAAU;CAC7B;AACF"}