You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/reference/react/cache.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,7 @@ The optimization of caching return values based on inputs is known as [_memoizat
64
64
65
65
- React will invalidate the cache for all memoized functions for each server request.
66
66
- Each call to `cache` creates a new function. This means that calling `cache` with the same function multiple times will return different memoized functions that do not share the same cache.
67
+
- React uses shallow comparison (`Object.is`) for arguments. Passing a new object or array on every call will bypass the cache.
67
68
-`cachedFn` will also cache errors. If `fn` throws an error for certain arguments, it will be cached, and the same error is re-thrown when `cachedFn` is called with those same arguments.
68
69
-`cache` is for use in [Server Components](/reference/rsc/server-components) only.
0 commit comments