android6-1 Exercise 3: Deferring a read ==================================== // Reads state during composition: the whole composable recomposes on every change Box(Modifier.offset(x = scrollOffset.dp)) // Reads state in the layout phase: only layout reruns, composition is skipped Box(Modifier.offset { IntOffset(x = scrollOffset, y = 0) }) Why this skips composition (docs): composition, layout and draw are separate phases. offset(x = value.dp) reads the state while composing, so each change recomposes. offset { ... } reads it inside the layout phase, so only layout reruns. Confirming it helped (general knowledge, with the docs' caution): Android Studio's Layout Inspector can show recomposition counts, and the Compose compiler reports show stability decisions, but the docs say not to rely on recomposition counts alone: use a benchmark or a profiler trace of frame times (Chapter 6 of Android Development with Compose: Production & Publishing returns to this) and compare before and after on a real device. Code unrun.