revalidatePath
A function from next/cache that invalidates cached data and pages for a given URL path.
In more detail
Call it in a Server Action or Route Handler after a mutation, such as revalidatePath('/products'). In an action the refreshed page comes back in the same response; elsewhere the path re-renders on its next visit.
Related terms
- revalidateTag — A function from next/cache that invalidates every cached entry labelled with a given tag, across all routes.
- revalidation — Refreshing cached data or pages so they show new content, either after a time limit or on demand.
- cache invalidation — Marking cached copies as out of date, or deleting them, when the real data changes so the next read fetches fresh data.
Taught in
- Optimistic UI: useOptimistic Rollbacks & Transitions — Next.js 15 & Modern App Router Architecture
- Router Cache: In-Memory Client Prefetch Semantics — Next.js 15 & Modern App Router Architecture
- Revalidation Strategies: revalidatePath & Cache Life — Next.js 15 & Modern App Router Architecture