Although this is a getter the value returned by it seems to always be the initial value in the scope of the closure
Copy code
var chats by useState(listOf<String>("first"))
useEffectOnce {
GlobalScope.launch {
client.rtmStream().collect {
val current = chats // always initial value
println(current)
chats = current + it.message
}
}
}