mirror of
https://github.com/theoludwig/theoludwig.git
synced 2024-11-05 04:51:30 +01:00
16 lines
294 B
TypeScript
16 lines
294 B
TypeScript
import { useEffect, useState } from "react"
|
|
|
|
export interface UseIsMountedResult {
|
|
isMounted: boolean
|
|
}
|
|
|
|
export const useIsMounted = (): UseIsMountedResult => {
|
|
const [isMounted, setIsMounted] = useState(false)
|
|
|
|
useEffect(() => {
|
|
setIsMounted(true)
|
|
}, [])
|
|
|
|
return { isMounted }
|
|
}
|