import { useEffect, useState } from "https://esm.sh/react";
export default function Component() {
const [text, setText] = useState("from server");
useEffect(() => {
console.log("from client");
const intervalId = setInterval(() => {
const currentTime = new Date().toLocaleTimeString();
setText(currentTime);
}, 1000);
return () => clearInterval(intervalId);
}, []);
return (
<div>
<p>{text}</p>
</div>
);
}