manifold/web/components/client-render.tsx
Austin Chen 76c4cd6d68
Render timestamps client-side to fix timezone (#58)
* Render timestamps client-side to fix timezone

* Fix compilation error
2022-03-02 23:51:58 -08:00

14 lines
348 B
TypeScript

// Adapted from https://stackoverflow.com/a/50884055/1222351
import { useEffect, useState } from 'react'
export function ClientRender(props: { children: React.ReactNode }) {
const { children } = props
const [mounted, setMounted] = useState(false)
useEffect(() => {
setMounted(true)
}, [])
return mounted ? <>{children}</> : null
}