Lauren Yew
01/04/2021, 9:03 PMmutableState
and State
: in the "Using State in Jetpack Compose" codelab, it says:
State<T> is intended to be used by Compose.
Application state that's used outside of Compose should not use State<T> to hold the state.
Why is this? Is State
being discarded along with the compose-recompose lifecycle or something?
Does anyone know the lifecycle of State
?Lauren Yew
01/04/2021, 9:09 PMSam
01/04/2021, 9:11 PMval conversations = store.mutableSubscribedStateOf({ it.conversations.dms })
Sam
01/04/2021, 9:13 PMSam
01/04/2021, 9:14 PMjim
01/04/2021, 9:15 PMLauren Yew
01/04/2021, 9:16 PMAdam Powell
01/04/2021, 9:28 PMAdam Powell
01/04/2021, 9:29 PMAdam Powell
01/04/2021, 9:32 PMmutableStateOf
-backed properties and snapshotFlow {}
or other snapshot APIs to observe changes at the fringes of or even entirely outside of a UI layer, but the codelab's advice will also get you to a clean, working app with fewer decision pointsColton Idle
01/04/2021, 9:45 PMAdam Powell
01/04/2021, 9:53 PM