Uberunix
08/14/2025, 12:16 PMvar amountInput by remember {mutableStateOf()}
However, in a new unit, I'm being directed to write it differently with no explanation.
var amountInput: MutableState<String> = mutableStateOf("0")
Is there an appreciable between these two idioms? Are there use-cases specific to each?MiSikora
08/14/2025, 12:37 PM@Composable
function and isn't a field in some class, then the second example is just wrong. It doesn't remember the MutableState
so it will be recreated every time a recomposition happens.Uberunix
08/14/2025, 1:33 PMUberunix
08/14/2025, 1:48 PMZach Klippenstein (he/him) [MOD]
08/14/2025, 2:06 PMUberunix
08/14/2025, 2:08 PMAlex Styl
08/14/2025, 2:50 PMUberunix
08/14/2025, 2:53 PMColton Idle
08/14/2025, 3:28 PMAlex Styl
08/15/2025, 1:24 AM