Loading content...
Loading content...
Next.js provides fast navigation using server rendering + client-side transitions
Next.js uses:
Server Rendering
Prefetching
Streaming
Client-side transitions
👉 Pages are rendered on the server
Prerendering → build time (fast)
Dynamic Rendering → request time
✔ Server sends data → client shows UI
👉 Loads pages in background before user clicks
plaintext
import Link from 'next/link';
<Link href="/blog">Blog</Link>✔ Automatic with <Link>
✔ Makes navigation instant
Static routes → fully prefetched
Dynamic routes → partially or skipped
Loads page in parts (faster UI)
plaintext
app/dashboard/loading.tsxplaintext
export default function Loading() {
return <p>Loading...</p>;
}✔ Shows loading UI first
✔ Then loads real content
👉 No full page reload
✔ Keeps layout
✔ Updates only page content
Faster navigation
Better user experience
No page refresh
Smooth transitions
Fix: add loading UI
generateStaticParamsFix: enable static generation
Use loading indicators
plaintextCopy
<Link href="/blog" prefetch={false}>Blog</Link>✔ Use when many links (performance optimization)
plaintext
window.history.pushState(null, '', '?sort=asc');✔ Adds new history entry
plaintext
window.history.replaceState(null, '', '/en/about');✔ Replaces current history