Skip to content

Instantly share code, notes, and snippets.

@cphoover
Created February 4, 2021 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cphoover/cb646021058bef681aeabd8e8c771424 to your computer and use it in GitHub Desktop.
Save cphoover/cb646021058bef681aeabd8e8c771424 to your computer and use it in GitHub Desktop.
const ClientOnly = ({ children }) => {
const [isVisible, setVisible] = useState(false);
useEffect(() => {
setVisible(true);
}, []);
return isVisible && children;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment