Readme

thx Joshua Comeau!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/** @jsxImportSource https://esm.sh/react */
import React from 'https://esm.sh/react'
export function ClientOnly({ children, ...delegated }) {
const [hasMounted, setHasMounted] = React.useState(false)
React.useEffect(() => {
setHasMounted(true)
}, [])
if (!hasMounted) {
return null
}
return (
<div {...delegated}>
{children}
</div>
)
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
July 21, 2024