Skip to content

Instantly share code, notes, and snippets.

@ch8n
Created October 17, 2022 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ch8n/187b2d34263b0af9cc4a01b451ffe5d3 to your computer and use it in GitHub Desktop.
Save ch8n/187b2d34263b0af9cc4a01b451ffe5d3 to your computer and use it in GitHub Desktop.
delegate Vs destructuring
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