Skip to content

Open-source status page, incident response and uptime monitoring

432 B
Raw Blame
import { useSyncExternalStore } from "react";

const subscribe = () => () => {};

/**
 * false on the server and during hydration, true afterwards. Gate output that
 * depends on the browser (timezone, locale) so SSR and the first client
 * render match; `suppressHydrationWarning` would keep the server text.
 */
export function useHydrated() {
  return useSyncExternalStore(
    subscribe,
    () => true,
    () => false,
  );
}