Skip to content

Commit dee6aed

Browse files
authored
[Beta] fix useMemo API doc error. (#5224)
1 parent 751a13f commit dee6aed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

beta/src/content/apis/react/useMemo.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ If your app is like this site, and most interactions are coarse (like replacing
9696
Optimizing with `useMemo` is only valuable in a few cases:
9797

9898
- The calculation you're putting in `useMemo` is noticeably slow, and its dependencies rarely change.
99-
- 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.
99+
- 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.
100100
- The value you're passing is later used as a dependency of some Hook. For example, maybe another `useMemo` calculation value depends on it. Or maybe you are depending on this value from [`useEffect.`](/apis/react/useEffect)
101101

102102
There is no benefit to wrapping a calculation in `useMemo` 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.
@@ -1333,4 +1333,4 @@ const Report = memo(function Report({ item }) {
13331333
</figure>
13341334
);
13351335
});
1336-
```
1336+
```

0 commit comments

Comments
 (0)