Next.js Hard technical 2 views 1 min read

How do you handle streaming and suspense in App Router?

Peer-reviewed by HireXTech Technical Panel Updated for 2025/2026 hiring Editorial standards
Practise this track
Interviewer Expectations for this Question
01
Core Competency

Assesses fundamental understanding of Next.js conventions, runtime behavior, and memory/performance considerations.

02
Evaluation Criteria

Hiring managers look for precision, avoidance of ambiguous jargon, and ability to explain trade-offs under real production conditions.

Comprehensive Model Answer Verified Solution

The App Router has built-in support for streaming and React Suspense, allowing you to progressively render and stream UI to the client.

// app/page.js
import { Suspense } from "react";

async function UserProfile({ userId }) {
  const user = await getUserData(userId); // This can be slow
  return <div>Welcome, {user.name}!</div>;
}

async function UserPosts({ userId }) {
  const posts = await getUserPosts(userId); // This can also be slow
  return (
    <div>
      {posts.map((post) => (
        <div key={post.id}>{post.title}</div>
      ))}
    </div>
  );
}

export default function Page({ params }) {
  return (
    <div>
      <h1>User Dashboard</h1>
      <Suspense fallback={<div>Loading profile...</div>}>
        <UserProfile userId={params.id} />
      </Suspense>
      <Suspense fallback={<div>Loading posts...</div>}>
        <UserPosts userId={params.id} />
      </Suspense>
    </div>
  );
}

Benefits of streaming:

  • Faster initial page load
  • Better perceived performance
  • Progressive enhancement
  • SEO-friendly as search engines can index content as it streams

Candidate Response Strategy & Interview Tips

  1. Start with a concise one-sentence summary: Deliver a direct, confident answer first before expanding into nuances.
  2. Demonstrate real-world trade-offs: Discuss where this approach excels and when you would avoid it in production systems.
  3. Discuss complexity & edge cases: Proactively explain time/space complexity or boundary conditions (null values, scale limits).
  4. Prepare for interviewer follow-ups: Technical hiring panels frequently probe deeper into concurrency, backward compatibility, or alternative libraries.
Related Topics & Skills
Spotted an error or have an alternative solution?