Код: Выделить всё
@Composable
fun MainScreen2(){
var counter by remember {
mutableIntStateOf(0)
}
LaunchedEffect(key1 = Unit, block = {
delay(5000)
Log.i("Launcher1", "1: $counter")
})
Column {
Log.i("Launcher", "column compose")
Text(text = "Count: $counter")
Button(onClick = { counter++ }) {
Text(text = "ADD")
}
test2(count = counter)
}
}
@Composable
fun test2(count: Int){
LaunchedEffect(key1 = true, block = {
delay(5000)
Log.i("Launcher", "2: $count")
})
}
Скажите, пожалуйста, почему?
Подробнее здесь: https://stackoverflow.com/questions/784 ... ture-value
Мобильная версия