Skip to content

Instantly share code, notes, and snippets.

@burnoo
Created April 4, 2022 16:30
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 burnoo/0df8d66a1dae460f7d3acd580948371d to your computer and use it in GitHub Desktop.
Save burnoo/0df8d66a1dae460f7d3acd580948371d to your computer and use it in GitHub Desktop.
Two-way data binding in Jetpack Compose 2
@Composable
fun Screen() {
val viewModel = remember { ViewModel() } // or viewModel() etc.
val password by viewModel.password.collectAsState()
TextField(
value = password,
onValueChange = viewModel::onPasswordChanged
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment