← 문제 목록
초급 Next.js 30P

async 서버 컴포넌트 params 접근 오류

다음 코드에서 버그를 찾으세요:
JAVASCRIPT
// app/posts/[id]/page.js

export default async function PostPage({ params }) {
    const post = await fetch(
        `https://api.example.com/posts/${params.id}`
    ).then(res => res.json());

    return <h1>{post.title}</h1>;
}

답변

로그인 후 제출하기
0명 풀이 · 정답률 0%