Files
calendar/packages/lib/components/NoSSR.tsx
T
Keith WilliamsandGitHub 7180eb067a refactor: Move @calcom/core to @calcom/lib (#19655)
* refactor: Move @calcom/core to @calcom/lib

* Merging imports

* Clean up

* Ignoreing type error for now
2025-03-02 23:02:35 -03:00

21 lines
409 B
TypeScript

import { useState, useEffect } from "react";
interface Props {
children: React.ReactNode; // React.ReactNode
fallback?: JSX.Element | null; // JSX.Element
}
const NoSSR = ({ children, fallback = null }: Props) => {
const [mounted, setMounted] = useState(false);
useEffect(() => setMounted(true), []);
if (!mounted) {
return fallback;
}
return <>{children}</>;
};
export default NoSSR;