import { useCallback, useEffect, useState } from 'react';
export default function useSsrCompat() {
  var _useState = useState(false),
      mounted = _useState[0],
      setMounted = _useState[1];

  var _useState2 = useState(mounted),
      rendered = _useState2[0],
      setRendered = _useState2[1];

  useEffect(function () {
    setMounted(true);
  }, []);
  useEffect(function () {
    if (mounted) {
      setRendered(true);
    }
  }, [mounted]);
  return [useCallback(function (render) {
    return mounted ? render() : null;
  }, [mounted]), rendered];
}