Any thoughts why this is not working? :thinking_fa...
# compose
n
Any thoughts why this is not working? 🤔
Copy code
@Composable
fun MyComposable() {
    val scope = rememberCoroutineScope()
    val count = mutableStateOf(0)
    val welcomeMsg = mutableStateOf("")
    launchInComposition {
        val s = withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
            delay(5000)
            "Hello Compose!"
        }
        welcomeMsg.value = s
    }
    Column {
        Text(text = welcomeMsg.value)
        Text(text = "Current count: ${count.value}")
        Button(onClick = {
            scope.launch {
                for (i in 1..10) {
                    withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
                        delay(1_000)
                    }
                    count.value = i
                }
            }
        }, content = { Text("Start!") })
    }
}