import { useEffect, useState } from 'react'; export type Post = { id: string; title: string }; export interface RevalidatingPostProps { postId: string; revalidateMs: number; initialPost: Post; fetchPost: (id: string) => Promise<Post>; } export function RevalidatingPost(props: RevalidatingPostProps) { // TODO: initialPost를 즉시 보여주는 state 만들기 // TODO: revalidateMs 이후 fetchPost로 재검증하기 (실패 시 기존 값 유지) // TODO: 정리(cleanup)도 잊지 마세요 return <article data-testid="post">{props.initialPost.title}</article>; }
Tests