Skip to content

Instantly share code, notes, and snippets.

@burnoo
Created April 4, 2022 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save burnoo/3426fd05af195503b4b87da8311f49b1 to your computer and use it in GitHub Desktop.
Save burnoo/3426fd05af195503b4b87da8311f49b1 to your computer and use it in GitHub Desktop.
Two-way data binding in Jetpack Compose 6
@Composable
fun Screen() {
val viewModel = remember { ViewModel() } // or viewModel() etc.
val (password, setPassword) = viewModel.password.collectAsMutableState()
TextField(
value = password,
onValueChange = setPassword
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment