It's called the "Compose basics" codelab because it's about the basics, the "Using State in Compose" delves into the hoisting pattern also with selected stuff in a lazyColumn. Anyway you don't even need a map, just a list of the selected items or their ids
api a try this sounds really interesting!! @Andrey Kulikov
@Andrey Kulikov That works like a charm! Although reading the docs of
It behaves similarly to remember, but the stored value will survive the activity or process recreation using the saved instance state mechanism (for example it happens when the screen is rotated in the Android application).
I am wondering if abusing this patter with say 1000 items in a list where each item is using
under the hood, I am wondering if this has any performance penalties? 🤔Other than that… I loved the idea and it was exactly what I was looking for! Thanks again!
I also noticed that it doesn’t work in Interactive Preview mode but maybe this is something to be fixed in the future versions of compose!
1 year ago
yes, this value will also be restored when the activity would be recreated. no performance penalty, but a bit of an extra memory to be kept, like 1000 booleans in this case