<Is There a More Efficient Way to Update Data Clas...
# stackoverflow
r
Is There a More Efficient Way to Update Data Class Properties in Jetpack Compose Kotlin? I have a data class in Jetpack Compose that represents a Car: data class Car( val id: Int = 0, val brand: String = "", val model: String = "", val year: Int = 2020 ) In my composable, I update the brand and model properties of this data class based on user input in TextField components. Currently, I am using the copy() function each time the user types something, like this: @Composable fun CarScreen() { var car by remember { mutableStateOf(Car()) } Column {...