Travis Griggs
04/06/2023, 6:53 PMvar foo by remember { mutableStateOf("stuff") }
and var foo = remember { mutableStateOf("stuff") }
look similar, but are two different things. The first is nice because I don't have to .value all access to what I really want out of it. But on the flip, it can't be passed to other composables to modify if that's desired. Do others tend to name them differently so it's clearer when a variable is one or the other? (e.g. foo
vs fooState
?)
2. I have these ItemCards which are nested composables. The part that will actually care/recompose is a composable nested 1-3 levels down. So you have to pass the state down. It's simpler if I "de-value" the observable right up top and just pass the primitive down the chain. But does that result in more recomposition than necessary? Is it better to pass the "holder" down the chain, until you get to the composable that actually cares about it's value and then devalue it at that point? Or is Compose magical/powerful enough that it doesn't matter?ephemient
04/06/2023, 6:58 PM() -> String
down the chain instead of State<String>
, it's more general and a pattern used in the compose librariesKirill Grouchnikov
04/06/2023, 7:31 PMKirill Grouchnikov
04/06/2023, 7:33 PMMutableState
isn't ideal in terms of understanding how data not only flows, but also where it's updatedTravis Griggs
04/06/2023, 7:42 PMKirill Grouchnikov
04/06/2023, 7:43 PMTravis Griggs
04/06/2023, 7:46 PMBen Trengrove [G]
04/06/2023, 9:58 PMHeader(selected: Int, onSelectedChanged: (Int)->Unit)
Ben Trengrove [G]
04/06/2023, 9:58 PMBen Trengrove [G]
04/06/2023, 10:00 PMTravis Griggs
04/07/2023, 4:08 PM