Next.js · Senior · Question 36 of 75

How does refresh() from next/cache differ from revalidatePath?

Explanation

refresh() in a Server Action makes the client router refetch the current page - e.g. to update a notification counter whose data isn't cached. If the data is cached, without revalidatePath/revalidateTag/updateTag the user sees the old value.

Further reading

Problem with a question

Next.js · Senior · question 36

Test yourself

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

Take this quiz