android4-4 Exercise 1: The Broken Counter ====================================== Imports: import androidx.compose.material3.Button import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue @Composable fun BrokenCounter() { var count = 0 // plain variable: Compose is not watching it Button(onClick = { count++ }) { Text("Clicked $count times") // never redrawn, and reset if redrawn for another reason } } Fixed version: @Composable fun Counter() { var count by remember { mutableIntStateOf(0) } // state Compose watches and keeps Button(onClick = { count++ }) { Text("Clicked $count times") } } Expected: the broken version shows "Clicked 0 times" forever, because count is an ordinary variable and nothing tells Compose to redraw (and if it were redrawn for another reason it would reset to 0). Why the fix works: mutableIntStateOf makes the value observable; remember keeps it between recompositions. Code unrun.