Created
October 17, 2022 13:37
-
-
Save ch8n/187b2d34263b0af9cc4a01b451ffe5d3 to your computer and use it in GitHub Desktop.
delegate Vs destructuring
This file contains hidden or 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
val(isChecked, setChecked) = remember { | |
mutableStateOf(value = false) | |
} | |
Checkbox( | |
checked = isChecked, | |
onCheckedChange = setChecked | |
) | |
// vs | |
var checked by remember { | |
mutableStateOf(value = false) | |
} | |
Checkbox( | |
checked = checked, | |
onCheckedChange = /* in place lambda */{ | |
checked = it | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment