From 822330c3dfa686dbb3424886abce116f20ed20e6 Mon Sep 17 00:00:00 2001 From: kavinkuma6 Date: Thu, 3 Nov 2022 12:33:25 +0530 Subject: [PATCH] fix #5212 (#5213) * fix #5212 * fix #5212 - conceptual error in useCallback reg memoization * remove unnecessary new line --- beta/src/content/apis/react/useCallback.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beta/src/content/apis/react/useCallback.md b/beta/src/content/apis/react/useCallback.md index f66faebc..0780dbd2 100644 --- a/beta/src/content/apis/react/useCallback.md +++ b/beta/src/content/apis/react/useCallback.md @@ -177,7 +177,7 @@ If your app is like this site, and most interactions are coarse (like replacing Caching a function with `useCallback` is only valuable in a few cases: -- You pass it as a prop to a component wrapped in [`memo`.](/apis/react/memo) You want to skip re-rendering if the value hasn't changed. Memoization lets your component re-render only when dependencies are the same. +- You pass it as a prop to a component wrapped in [`memo`.](/apis/react/memo) You want to skip re-rendering if the value hasn't changed. Memoization lets your component re-render only when dependencies aren't the same. - The function you're passing is later used as a dependency of some Hook. For example, another function wrapped in `useCallback` depends on it, or you depend on this function from [`useEffect.`](/apis/react/useEffect) There is no benefit to wrapping a function in `useCallback` in other cases. There is no significant harm to doing that either, so some teams choose to not think about individual cases, and memoize as much as possible. The downside of this approach is that code becomes less readable. Also, not all memoization is effective: a single value that's "always new" is enough to break memoization for an entire component.