You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Otherwise, here is a React 18 component with TypeScript people may use.
no-ssr.tsx
import{ReactNode,useEffect,useState}from'react';interfaceNoSSRProps{/** * Optional content to show before the component renders on client. * This renders during server-side rendering (SSR). */onSSR?: React.FC;/** * The content to render on client. */children?: ReactNode;}constEmptySpan: React.FC=(): ReactNode=><span/>;constNoSSR: React.FC<NoSSRProps>=(props: NoSSRProps): ReactNode=>{const{ onSSR =EmptySpan, children =<EmptySpan/>}=props;const[isMounted,setIsMounted]=useState<boolean>(false);useEffect(()=>{setIsMounted(true);return()=>{setIsMounted(false);};});returnisMounted ? children : onSSR({});};export{NoSSR};
Please update to React 18
The text was updated successfully, but these errors were encountered: