import { useLayoutEffect, useRef } from 'react';
import { useForceRerender } from "./useForceRerender.js";
export function useFirstRender(callbackOrOptions) {
    const options = typeof callbackOrOptions === 'function' ? undefined : callbackOrOptions;
    const callback = typeof callbackOrOptions === 'function' ? callbackOrOptions : options?.callback;
    const firstRender = useRef(true);
    const [rerender] = useForceRerender();
    useLayoutEffect(() => {
        if (!firstRender.current)
            return;
        firstRender.current = false;
        callback?.();
        if (options?.immediatelyRerender) {
            rerender();
        }
        // oxlint-disable-next-line react-hooks/exhaustive-deps
    }, []);
    return firstRender.current;
}
//# sourceMappingURL=useFirstRender.js.map