Browse Source

[beta] Added documentation for the useMemo() API reference. (#4928)

* Documentation for useMemo API

* updated

* Update useMemo.md

* Expand useMemo ref

* tweaksg

* oops

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
main
Arati Chilad 2 years ago
committed by GitHub
parent
commit
fdc12db196
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      beta/src/content/apis/react/index.md
  2. 1178
      beta/src/content/apis/react/useMemo.md
  3. 3
      beta/src/sidebarReference.json

8
beta/src/content/apis/react/index.md

@ -349,7 +349,9 @@ useInsertionEffect(() => {
Return a memoized callback. Return a memoized callback.
```js ```js
const memoizedCallback = useCallback(callback, [...deps]); const handleClick = useCallback(() => {
doSomething(a, b);
}, [a, b]);
``` ```
</YouWillLearnCard> </YouWillLearnCard>
@ -359,7 +361,9 @@ const memoizedCallback = useCallback(callback, [...deps]);
Return a memoized value. Return a memoized value.
```js ```js
const memoizedValue = useMemo(() => value, [...deps]); const value = useMemo(() => {
return calculateValue(a, b);
}, [a, b]);
``` ```
</YouWillLearnCard> </YouWillLearnCard>

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

File diff suppressed because it is too large

3
beta/src/sidebarReference.json

@ -130,8 +130,7 @@
}, },
{ {
"title": "useMemo", "title": "useMemo",
"path": "/apis/react/useMemo", "path": "/apis/react/useMemo"
"wip": true
}, },
{ {
"title": "useReducer", "title": "useReducer",

Loading…
Cancel
Save