Created
May 5, 2023 15:44
-
-
Save mddanishansari/65fed3b80452d5ecff0ee91bd39fbb4b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun ListWithJustColumn() { | |
Column { | |
(1..5).toList().forEach { number -> | |
var text by remember { mutableStateOf("$number: ") } | |
println(text) // This log is printed for all items even if it is changed for just one time | |
OutlinedTextField(value = text, onValueChange = { text = it }) | |
} | |
} | |
} | |
@Composable | |
fun ListWithLazyColumn() { | |
LazyColumn { | |
items(5) { number -> | |
var text by remember { mutableStateOf("$number: ") } | |
println(text) // This log is printed for item only which is changed | |
OutlinedTextField(value = text, onValueChange = { text = it }) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment