Content pfp
Content
@
0 reply
0 recast
0 reaction

rapha pfp
rapha
@rapharrrr
1/2 Some clarification on React / Next.js cache APIs for those who don't use React Query: React Cache Function: ◾ Terrible name, since it's only used for deduplication. ◾ It doesn't persist data across requests. ◾ Use it if you're calling the same function multiple times within the same render. Example: you need the data in multiple server components, so you can call the same function (wrapped in cache()) in different components instead of passing down props. Requests will be deduplicated and only one will actually be fired. Feels weird, but valid.
1 reply
1 recast
2 reactions

rapha pfp
rapha
@rapharrrr
2/2 Next.js unstable_cache: ◾ Still experimental. ◾ Much closer to React Query ◾ Uses tags for invalidation ◾ Persists data across requests and server restarts until caches gets: ▫️ manually revalidated by revalidateTag() or revalidatePath() ▫️ automatically revalidated by reaching the time set in the 'revalidate' option
1 reply
1 recast
1 reaction