// app/layout.tsx — the ONE layout that must exist. Renders /.exportdefaultfunctionRootLayout({ children }: { children: React.ReactNode }) {
return (
{children}
);
}
// app/blog/[slug]/page.tsx — a Server Component that fetches directly. No useEffect.exportdefaultasyncfunctionPost({ params }: { params: Promise }) {
const { slug } = await params; // Next 15: params is a Promiseconst post = awaitgetPost(slug); // runs on the server, secrets safereturn {post.title};
}
// A leaf that needs interactivity opts INTO the client. Push it to the leaf.'use client';
import { useState } from'react';
exportfunctionLikeButton() {
const [liked, setLiked] = useState(false);
returnsetLiked((v) => !v)}>{liked ? '♥' : '♡'};
}