Jetpack Compose gives you two closely related functions for holding UI state: remember and rememberSaveable . They look almost identical in code but behave very differently when your app is rotated, backgrounded, or process-killed by the system. Picking the wrong one is a common source of "why did my state just disappear" bugs.
Quick Comparison
Aspect remember rememberSaveable
Survives recomposition Yes Yes
Survives configuration change (rotation) No Yes
Survives process death + restore No Yes, in most cases
Requires a saveable type No Yes, Parcelable/primitive or a custom Saver
What remember Actually Does
remember stores a value in the Composition - the in-memory tree Compose builds to describe your UI.…