mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-08 02:03:34 +08:00
docs: tighten kotlin support examples
This commit is contained in:
committed by
Affaan Mustafa
parent
f6a470de63
commit
7433610105
@@ -252,11 +252,12 @@ val showScrollToTop by remember {
|
||||
// BAD — new lambda and list every recomposition
|
||||
items.filter { it.isActive }.forEach { ActiveItem(it, onClick = { handle(it) }) }
|
||||
|
||||
// GOOD — remember filtered list, stable lambda with key
|
||||
// GOOD — key each item so callbacks stay attached to the right row
|
||||
val activeItems = remember(items) { items.filter { it.isActive } }
|
||||
activeItems.forEach { item ->
|
||||
val onClick = remember(item.id) { { handle(item) } }
|
||||
ActiveItem(item, onClick = onClick)
|
||||
key(item.id) {
|
||||
ActiveItem(item, onClick = { handle(item) })
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user