1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2025-05-29 22:37:44 +02:00

fix: hydratation error with age calculation

This commit is contained in:
2024-04-06 20:32:09 +02:00
parent 982b148329
commit cd5e92b64a
2 changed files with 26 additions and 6 deletions

15
hooks/useIsMounted.ts Normal file
View File

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