mount() or hydrate().
Since 5.13.0, if options.outro is true, transitions will play before the component is removed from the DOM. Returns a Promise that resolves after transitions have completed if options.outro is true, or immediately otherwise.
Parameters
The component instance returned by
mount() or hydrate()Optional configuration for unmounting
Whether to play outro transitions before removing the component from the DOM (available since 5.13.0)
Returns
A promise that resolves after transitions have completed if
options.outro is true, or immediately otherwiseExamples
Basic usage
With outro transitions
Conditional unmounting
Notes
- Calling
unmount()on a component that was never mounted or has already been unmounted will resolve immediately without error (in production) - In development mode, attempting to unmount a component twice will trigger a warning
- If
outroistrue, the promise will wait for all outro transitions to complete before resolving - The component and all its child components will be destroyed, and cleanup functions will be called