onCleanup

inline fun onCleanup(crossinline cleanupFunc: () -> Unit): CleanupFunc

Defines a cleanup function to be invoked when the owning Component is detached or the deps in useEffect change.