1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2024-11-12 23:33:14 +01:00
.profile/hooks/useIsMounted.ts

16 lines
294 B
TypeScript
Raw Normal View History

import { useEffect, useState } from "react"
export interface UseIsMountedResult {
isMounted: boolean
}
export const useIsMounted = (): UseIsMountedResult => {
const [isMounted, setIsMounted] = useState(false)
useEffect(() => {
setIsMounted(true)
}, [])
return { isMounted }
}