import { useSyncExternalStore } from 'react'; const subscribeNoop = () => () => {}; // False while prerendering and during the hydrating render, true afterwards // (and at once for components that mount later). Same behaviour as the // useHydrated that the router keeps internally. export default function useHydrated() { return useSyncExternalStore( subscribeNoop, () => true, () => false, ); }