. When that state updates, it means that something else (that isn't directly observable or a state) updated as well, and I want to use that in a composable. What's the better approach (aside from refactoring to get away from this issue):
Copy code
val current by foo.updates.collectAsState()
val bar by remember(current) { foo.bar }
or
Copy code
val current by foo.updates.collectAsState()
val bar by remember {
derivedStateOf {
current // just to get the update
foo.bar
}
}
eygraber
01/19/2024, 6:27 PM
I'm using
remember(current)
in the first one because it doesn't seem like the whole scope recomposes when