1. 21
    Refresh Data with Next.js revalidatePath when submitting a Server Action
    1m 22s

Refresh Data with Next.js revalidatePath when submitting a Server Action

InstructorBen Patton

Share this video with your friends

Send Tweet

When you create data, you want to see that data reflected in your UI as quickly as possible. In our previous implementation we were doing that with react-query by invalidating it's cache so it would fetch customers again.

Using the revalidatePath function from next/cache in combination with our server action we can add a customer and see the must up-to-date data