The React documentation says the following about useMemo
You may rely on useMemo as a performance optimization, not as a semantic guarantee. In the future, React may choose to “forget” some previously memoized values and recalculate them on next render, e.g. to free memory for offscreen components. Write your code so that it still works without useMemo — and then add it to optimize performance.
For useCallback there is the following line:
useCallback(fn, deps) is equivalent to useMemo(() => fn, deps).
The word "equivalent" is a bit fuzzy for me and I don't know if that also means that useCallback does not provide a semantic guarantee.