What happens to a memoized value in useMemo when the component unmounts?
When a component unmounts, the memoized value from useMemo is immediately discarded. React cleans up all hooks and their associated data when components unmount. If the component remounts later, the memoized computation will start fresh, calculating the initial value again based on the current dependencies. This behavior ensures that memory is freed properly and prevents memory leaks.