dimsuz
09/01/2020, 5:56 PMval inputState: TextFieldValue by mutableStateOf(TextFieldValue())
TextField(value = inputState.value, onValueChange = { inputState = it })
But if I wrap in remember
than text input starts working. I am asking because Compose State codelab has examples which have only by mutableStateOf
and no remember
(for example in ViewModel section), but TextField turns out to be special here?flosch
09/01/2020, 6:04 PMremember
is needed if you want to keep the MutableState
across recompositions of your `Composable`s. In the ViewModel
you do not need it, because the ViewModel
is not recomposed and the MutableState
is not lost.Zach Klippenstein (he/him) [MOD]
09/01/2020, 6:05 PMdimsuz
09/01/2020, 6:05 PM