manifold/web/components/client-render.tsx
Marshall Polaris 420ea9e90e
Add more linting to web package (#343)
* Import React a lot

* Fix misc. linting concerns

* Turn on many recommended lints for `web` package
2022-05-26 14:41:24 -07:00

14 lines
355 B
TypeScript

// Adapted from https://stackoverflow.com/a/50884055/1222351
import React, { 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
}