'use client'; import Image from 'next/image'; import Link from 'next/link'; import { useEffect, useState } from 'react'; import { getPetById } from '@/src/client/sdk.gen'; import type { Pet } from '@/src/client/types.gen'; export default function Home() { const [pet, setPet] = useState(); const [petId, setPetId] = useState(8); useEffect(() => { const fetchPet = async () => { const { data } = await getPetById({ cache: 'force-cache', next: { revalidate: 10, tags: ['pet'], }, path: { petId, }, }); if (data) { setPet(data); } }; fetchPet(); }, [petId]); return (
Next.js logo
  1. Pet name:{' '} {pet?.name}
  2. Press the button below to fetch a random pet
Server component
); }