useHasMounted
Lifecycle hook providing ability to check component's mount state. Returns
true if component mounted and false otherwise.
Import#
import { useHasMounted } from '@dwarvesf/react-hooks'
Return value#
Returns true if component mounted and false otherwise.
Usage#
My component
function Example() {const hasMounted = useHasMounted()if (!hasMounted) {return null}return <p>My component</p>}
Editable Example