Next.js · Middle · Question 6 of 75

What does the 'use cache' directive do?

Explanation

'use cache' works with cacheComponents: true: at the level of a data function, a component or a whole file. Arguments and captured values become part of the key. The lifetime is set with cacheLife, invalidation tags with cacheTag. A cached result can become part of the page's static shell.

Further reading

Problem with a question

Next.js · Middle · question 6

Test yourself

Take the Next.js · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz