The documentation says React may discard memoised values to free memory, and code that treats useMemo as a cache with a guarantee is relying on something that is not promised.
// fine: an optimisation. recomputing is harmless.
const sorted = useMemo(() => rows.sort(byDate), [rows]);
// NOT fine: correctness depends on identity being stable
const socket = useMemo(() => new WebSocket(url), [url]);
// use a ref, or an effect. this may be recreated.
The distinction is whether recomputing is merely wasteful or actually wrong. Anything with an identity that matters — a subscription, a connection, an object used as a Map key — belongs in a ref or an effect with a cleanup. In practice React has never discarded them, which is exactly why relying on it is a bad habit rather than an obvious bug.