Files
portabase/src/state-management/HydratationZustand.tsx
T

16 lines
360 B
TypeScript
Raw Normal View History

2024-12-12 13:31:11 +01:00
"use client"
import {useEffect, useState} from "react"
const HydrationZustand = ({children}) => {
const [isHydrated, setIsHydrated] = useState(false)
// Wait till Next.js rehydration completes
useEffect(() => {
setIsHydrated(true)
}, [])
return <>{isHydrated ? <div>{children}</div> : null}</>
}
export default HydrationZustand