Skip to content
GaudiGaudi Design System home

Search documentation

Search every page, heading and paragraph.

useUnmount

Run the latest committed callback when an effect is cleaned up.

HooksState@gaudi/design-system/hooks/state/use-unmountView in StorybookSource

Keeps a fresh callback without recreating the subscription. Runs during unmount and React Strict Mode effect probes; callbacks must tolerate repeated setup/cleanup.

Usage

import { useUnmount } from '@gaudi/design-system/hooks';
useUnmount(() => releasePreview());

Examples

Playground

Storybook

API

1 option
1 return value

Accessibility

Do not announce routine cleanup or steal focus. Restore focus through the owning overlay component.

Notes

  • For resource acquisition, prefer a normal effect that returns the cleanup for that exact resource.