Skip to content

Instantly share code, notes, and snippets.

@timneutkens
Created August 15, 2019 05:47
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 timneutkens/3fd5946b2e52bd1cdd42467c4ba2959e to your computer and use it in GitHub Desktop.
Save timneutkens/3fd5946b2e52bd1cdd42467c4ba2959e to your computer and use it in GitHub Desktop.
import {useState, useEffect} from 'react'
function useMounted() {
const [isMounted, setMounted] = useState(false)
useEffect(() => setMounted(true), [])
return isMounted
}
// const isMounted = useMounted()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment