This content is generated client-side. Datestamp:
The above component is a client component that does not trigger the hydration errors. The source code is below:
'use client' import {useEffect, useState} from "react"; export default ()=>{ const [isServer,setServer] = useState(true); useEffect(setServer,[]); return ( <p class={"client-component"}> This content is generated client-side. Datestamp: {isServer ? '' : Date.now()} </p> ); }
This approach lets the component control how it handles SSR.
Let's revisit this - What does this really mean?
But what if a reusable Client Component doesn't do this itself, and causes hydration errors because of SSR?