https://kotlinlang.org logo
#compose
Title
# compose
g

Grigorii Yurkov

10/29/2020, 6:44 PM
What do you think, did I implement it right?
Copy code
@Composable
val composableScope: CoroutineScope
    get() {
        val context = SupervisorJob() + Dispatchers.Main.immediate
        onDispose {
            context.cancel()
        }
        return CoroutineScope(context)
    }
Or maybe there is out-of-the-box solution?
l

Leland Richardson [G]

10/29/2020, 6:45 PM
You’re looking for
rememberCoroutineScope()
👍 5