#How do I mutate a response from the on the client without revalidating?

1 messages · Page 1 of 1 (latest)

uncut flower
#

How do I mutate a response from the on the client without revalidating?

undone timberBOT
#

Hi @uncut flower. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the information provided in the extracts, Next.js does not provide a built-in way to mutate a response on the client without revalidating. The revalidation process is a core part of the data fetching strategy in Next.js, and it's designed to ensure that your application always has the most up-to-date data.

However, you can use third-party libraries such as SWR (https://swr.vercel.app/) or TanStack Query (https://tanstack.com/query/latest) to fetch data on the client. These libraries provide their own APIs for memoizing requests, caching, revalidating, and mutating data.

Please note that using the use function to handle a promise returned by a fetch request is currently not recommended in Client Components as it may trigger multiple re-renders.

For more information, you can refer to the Next.js documentation on data fetching (https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#fetching-data-on-the-client-with-third-party-libraries).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@deep coyote kapa.ai is still learning and improving, please let us know how it did by reacting below

uncut flower
#

Why is use not recommened?