@Composable
fun MyComposable() {
var counter by remember {
mutableStateOf(0)
}
Box {
Text(text = "Inside the Box")
Column {
Surface {
CustomText(text = "Recomposed $counter times")
}
Button(onClick = { counter++ }) {
Text(text = "Tap to recompose")
}
}
}
}
Why does Surface scope recompose when we tap the Button in the screen rendered by MyComposable?