import { useEffect , useState } from 'react' ; export type ClientOnlyProps = { children : React . ReactNode ; } ; export function ClientOnly ( { children } ) { const [ hasMounted , setHasMounted ] = useState ( false ) ; useEffect ( ( ) => { setHasMounted ( true ) ; } , [ ] ) ; if ( ! hasMounted ) { return null ; } return < > { children } < />; }