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

K

12/06/2023, 7:25 AM
Copy code
private val myState: MutableState<String> = mutableStateOf("test")

    val stateValue1: String by myState

    val stateValue2: String
        get() = myState.value
Access
stateValue1
and
stateValue2
field from Composable function. Both trigger recompose after state value changed?
It might be a stupid question. It's something like MutableState object detect Composable from thread local or something, and then recompose that?
s

shikasd

12/06/2023, 7:36 AM
Kind of that, yep. See
Snapshot.current
k

K

12/06/2023, 7:40 AM
Oh yes. SnapshotThreadLocal.
4 Views