/** * Options for the useMounted hook. */ export interface UseMountedOptions { /** * Callback invoked when the component transitions to mounted state. */ onMounted?: () => void; /** * Callback invoked when the component transitions to unmounted state * or when the component is destroyed while mounted. */ onUnmounted?: () => void; } /** * Custom hook that tracks whether a component is mounted on the client. * Provides SSR-safe mounting detection with optional lifecycle callbacks. * * @param {UseMountedOptions} options configuration options * @returns {boolean} whether the component is currently mounted * * @example * ```tsx * const MyComponent = () => { * const mounted = useMounted({ * onMounted: () => console.log('Mounted'), * onUnmounted: () => console.log('Unmounted') * }); * * if (!mounted) return null; * * return