Hi I am trying to understand differences between the below two lambda expression. Please suggest where I can read. Thank you
val count = remember { mutableStateOf(0) }
onClick{count.value++} vs onClick{count++}
Hi I am trying to understand differences between the below two lambda expression. Please suggest where I can read. Thank you
val count = remember { mutableStateOf(0) }
onClick{count.value++} vs onClick{count++}
You mean count.value
vs count
? Please read delegated properties
Without delegation:
val count: MutableState<Int> = remember { mutableStateOf(0) }
/* ... */
count.value++
With delegation:
var count: Int by remember { mutableStateOf(0) }
/* ... */
count++