Getting Started with Next.js App Router
Next.js 14 introduced the stable App Router, bringing React Server Components to the mainstream.
Why App Router?
- Server Components by default
- Streaming and Suspense
- Better data fetching
- Layouts and nested routes
Data Fetching
async function getPosts() {
const res = await fetch('https://api.example.com/posts');
return res.json();
}
export default async function Page() {
const posts = await getPosts();
return <PostsList posts={posts} />;
}
Conclusion
The App Router is the future of Next.js.
