onDispose

fun onDispose(callback: () -> Unit)

An effect used to schedule work to be done when the effect leaves the composition.

The onDispose effect is essentially a convenience effect for onPreCommit(true) { onDispose { ... } }.

See also

Parameters

callback

The lambda to be executed when the effect leaves the composition.