How to handle visibility of a Text in Jetpack Compose?

As CommonsWare stated, compose being a declarative toolkit you tie your component to a state (for ex: isVisible), then compose will intelligently decide which composables depend on that state and recompose them. For ex:

fun MyText(isVisible: Boolean){
     Text(text = stringResource(id = R.string.hello))

Also you could use the AnimatedVisibility() composable for animations.

Leave a Comment