Explain how to create a custom hook with memoization to improve performance.

Custom hooks can use useMemo to cache values based on dependencies, reducing redundant calculations and improving performance.

function useCachedData(data) {
  return useMemo(() => processData(data), [data]);
}