Home > Software engineering >  Android Jetpack Compose - Composable Function get recompose each time Text-field value changes
Android Jetpack Compose - Composable Function get recompose each time Text-field value changes

Time:09-12

I'm using TextField to get user input and using stateflow to handle the text state/value in viewmodel.

The thing is everytime textfield value changes HomeContent() function get recomposed. enter image description here

CodePudding user response:

Don't extract a val outside the HelloContent's calling site. Move the initialization logic to the lambda.

  • Related