← 문제 목록
고급 Next.js 100P

Streaming과 Suspense 경계 설정 오류

다음 코드에서 버그를 찾으세요:
JAVASCRIPT
// app/dashboard/page.js
import { Suspense } from 'react';

async function SlowComponent() {
    const data = await fetchSlowData(); // 5초 소요
    return <div>{data.summary}</div>;
}

async function FastComponent() {
    const data = await fetchFastData(); // 0.1초 소요
    return <div>{data.info}</div>;
}

export default function Dashboard() {
    return (
        <Suspense fallback={<div>전체 로딩 중...</div>}>
            <FastComponent />
            <SlowComponent />
        </Suspense>
    );
}
// FastComponent도 SlowComponent가 완료될 때까지 5초 동안 표시되지 않음

답변

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