"use client"; import { useEffect, useState } from "react"; export default function Home() { const [count, setCount] = useState(null); useEffect(() => { fetch("http://localhost:8000/api/counter") .then((res) => res.json()) .then((data) => setCount(data.value)); }, []); const increment = async () => { const res = await fetch("http://localhost:8000/api/counter/increment", { method: "POST", }); const data = await res.json(); setCount(data.value); }; return (

{count === null ? "..." : count}

); }