FrontEnd Flashcards

1
Q

useMemo

A

“caches” data that is not necessary to recalculate during state update due to it’s value not changing.
It does create a memory overhead by storing said values.

Use cases:
- preventing a slow function from being recreated
- avoids reference comparison of data that doesn’t change.

Returns: outcome of function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

useCallback

A

“caches” a function that doesn’t need recreation on component re-render.

Use cases:
- prevent a function from being recreated when not necessary

Returns: whole function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly