1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2025-10-11 17:06:21 +02:00
Files
.profile/packages/react-hooks/src/useIsMounted.ts
Théo LUDWIG 7bde328b96 perf!: monorepo setup + fully static + webp images
BREAKING CHANGE: minimum supported Node.js >= 22.0.0 and pnpm >= 9.5.0
2024-07-30 23:59:06 +02:00

16 lines
294 B
TypeScript

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