2022-03-03 07:51:58 +00:00
|
|
|
// Adapted from https://stackoverflow.com/a/50884055/1222351
|
2022-05-26 21:41:24 +00:00
|
|
|
import React, { useEffect, useState } from 'react'
|
2022-03-03 07:51:58 +00:00
|
|
|
|
|
|
|
export function ClientRender(props: { children: React.ReactNode }) {
|
|
|
|
const { children } = props
|
|
|
|
|
|
|
|
const [mounted, setMounted] = useState(false)
|
|
|
|
useEffect(() => {
|
|
|
|
setMounted(true)
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
return mounted ? <>{children}</> : null
|
|
|
|
}
|