Next.js Discord

Discord Forum

is it possible to populate cache() before hand?

Unanswered
Nile Crocodile posted this in #help-forum
Open in Discord
Nile CrocodileOP
I've got an endpoint that returns posts. would love to know if i can populate cache() with each post by id. Need it so when i navigate to the posts page from the posts lists it doesnt refetch the post by id and rather get it from cache.

ive done the same thing with tanstack-query's setQueryData but that means i have to keep using a client component instead of a server one

0 Replies