import { useState, useEffect } from 'react';

/**
 * Returns `false` during SSR and the first client render (hydration),
 * then `true` after mount. This ensures server and client produce
 * identical initial HTML, and portals are activated only after
 * hydration completes.
 */
function useIsClient() {
    const [isClient, setIsClient] = useState(false);
    useEffect(() => {
        setIsClient(true);
    }, []);
    return isClient;
}

export { useIsClient };
