Garret Yoder
02/29/2024, 8:10 PMZach Klippenstein (he/him) [MOD]
02/29/2024, 8:23 PMGarret Yoder
02/29/2024, 8:24 PMZach Klippenstein (he/him) [MOD]
02/29/2024, 8:25 PMGarret Yoder
02/29/2024, 8:26 PMCasey Brooks
02/29/2024, 8:27 PMremember { }
blocks will be remembered when you swap the instance. When you set it to null, you remove the corresponding block of code from the composition, and then add it back later, which is why it clears the remembered state valuesGarret Yoder
02/29/2024, 8:28 PMZach Klippenstein (he/him) [MOD]
02/29/2024, 8:28 PMclass Foo {
private var bar by mutableStateOf(…)
@Composable fun foo() {
var baz by remember { mutableStateOf(…) }
}
}
Here bar
is owned by the object, and if you pass a different object, the composable will see a new object for bar
.
baz
OTOH is owned by the composition, and will stay the same object even if a different instance of Foo
Zach Klippenstein (he/him) [MOD]
02/29/2024, 8:29 PMfoo
is
@Composable fun foo(receiver: Foo) {
var baz by remember { mutableStateOf(…) }
}
Zach Klippenstein (he/him) [MOD]
02/29/2024, 8:29 PMkey
function to keep composable state associated with their list item when list items move aroundCasey Brooks
02/29/2024, 8:29 PMGarret Yoder
02/29/2024, 8:30 PMCasey Brooks
02/29/2024, 8:30 PM