Next.js · Senior · Question 26 of 75
How do GET Route Handlers behave with Cache Components enabled?
- ✓Correct answer: They follow the same prerendering model as pages
- 2They're always dynamic and never cached
- 3They're always static; request data isn't available in them
Explanation
If the handler doesn't read request data, its response can be prerendered at build time; use 'use cache' for cacheable parts. Accessing request, cookies() or headers() makes the response dynamic. Methods other than GET are always dynamic.