Both useMemo and useCallback receive the same parameters. The first parameter is the callback and the second parameter is the data to depend on

1. Recalculate the result only when the data changes, that is, it serves as a cache.

The difference between useMemo and useCallback is as follows: 1. The useMemo calculation result is the value returned by the return and is mainly used to cache the calculated value. The application scenario is as follows: Status to be computed 2. Functions that need to be cached because functional components are rerefreshed every time there is a change in state. Some functions need to be cached to improve performance and reduce resource waste.