Next.js Discord

Discord Forum

can i use cache components for data fetching functions?

Answered
Masai Lion posted this in #help-forum
Open in Discord
Masai LionOP
is use cache explicit for components or can i use it within data fetching functions to cache the response for say something like blog categories, where i may get blog categories in the header area and also in the body while minimizing fetches until the tag is revalidated?
Answered by Sun bear
You can use it for fetching functions as well. Take a look at these docs, especially function level part:

https://nextjs.org/docs/app/api-reference/directives/use-cache#usage
View full answer

2 Replies

Sun bear
You can use it for fetching functions as well. Take a look at these docs, especially function level part:

https://nextjs.org/docs/app/api-reference/directives/use-cache#usage
Answer
Masai LionOP
thank you!