I have this in a lazyColumn: ```items(state.newsFe...
# compose
n
I have this in a lazyColumn:
Copy code
items(state.newsFeedItems) { item ->
                        ResultsChip(item, navController)
                    }
The
newsFeedItems
come from a room database. When I click on a
ResultsChip
I get the corresponding item in my next screen. When I navigate back and click on another
ResultsChip
for some reason I get the item of the first chip in my next screen. Is there something when navigating back that
remembers
the previous item? Why does clicking on a second chip not yield the second chip item but the first one's?
z
I believe if you pass a lambda that produces a unique value for every item in the key param then it should behave as expected. This explains it more in detail: https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/package-summary#(androidx.compose.foundation.lazy.LazyListScope).items(kotlin.collections.List,kotlin.Function1,kotlin.Function1,kotlin.Function2)
n
Thank you for this! 😊