useCoroutine

fun ComponentScope.useCoroutine(vararg keys: Any?, onLaunch: suspend CoroutineScope.() -> Unit)

Launches a coroutine with onLaunch whenever keys change. The coroutine will be canceled when the component is detached, or if the coroutine will be relaunched.

The CoroutineScope for this coroutine must be specified through a TreeProp.


fun ComponentScope.useCoroutine(onLaunch: suspend CoroutineScope.() -> Unit)

Deprecated (with error)

useCoroutine must provide 'keys' parameter that determines whether the existing coroutine will be canceled, and the new coroutine will be launched

Launches a coroutine with onLaunch. The coroutine will be canceled when the component is detached, or if the coroutine will be relaunched.

It is an error to call ComponentScope.useCoroutine without keys parameter.