0
0
NextJSframework~5 mins

Route prefetching behavior in NextJS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is route prefetching in Next.js?
Route prefetching in Next.js means loading the code and data for a page before the user clicks the link. This makes navigation faster because the page is ready to show immediately.
Click to reveal answer
intermediate
How does Next.js decide when to prefetch a route?
Next.js prefetches routes automatically when a Link component is visible in the viewport and the browser is idle. This helps avoid slowing down the main tasks.
Click to reveal answer
beginner
Can you disable route prefetching in Next.js? How?
Yes, you can disable prefetching by adding prefetch={false} to the Link component. This stops Next.js from loading the page early.
Click to reveal answer
intermediate
What happens if a user never clicks a prefetched link?
If the user never clicks the prefetched link, the loaded data stays in the browser cache but is not used. This can use some bandwidth but improves speed if the user does click later.
Click to reveal answer
beginner
Why is route prefetching important for user experience?
Route prefetching makes pages load instantly when users click links. This feels smooth and fast, like flipping pages in a book without waiting.
Click to reveal answer
When does Next.js automatically prefetch a route?
AWhen the page loads, regardless of visibility
BOnly after the user clicks the link
CWhen the <code>Link</code> is visible and the browser is idle
DWhen the user scrolls to the bottom of the page
How can you stop Next.js from prefetching a route?
APrefetching cannot be stopped
BRemove the <code>Link</code> component
CUse a different router library
DAdd <code>prefetch={false}</code> to the <code>Link</code> component
What is a benefit of route prefetching?
APages load instantly when clicked
BIt reduces server load
CIt disables JavaScript on the page
DIt prevents caching
If a prefetched page is never visited, what happens?
AThe prefetched data stays cached but unused
BThe browser deletes the data immediately
CThe server is notified to cancel the prefetch
DThe page automatically loads anyway
Which Next.js component is involved in route prefetching?
A<code>Head</code>
B<code>Link</code>
C<code>Script</code>
D<code>Image</code>
Explain how route prefetching works in Next.js and why it improves user experience.
Think about how loading pages early helps users feel the app is faster.
You got /4 concepts.
    Describe how you can control route prefetching behavior in a Next.js app.
    Focus on the Link component and its prefetch property.
    You got /4 concepts.