Skip to main content
InterviewHubPRO
Section Overview
Q5

Question 5 of 50

Part 1: Architecture, Jetpack Compose & Core Components (1 - 10)

10%
Android & Jetpack Compose (50 Qs)•Part 1: Architecture, Jetpack Compose & Core Components (1 - 10)

What is the difference between `remember` and `rememberSaveable` in Compose?

senior LevelComponentsDocker & ContainersSystem Design

In Simple Words:

  • remember { mutableStateOf(...) }: Preserves state across recompositions (when the composable function re-runs). However, the state is lost if the Activity is recreated (screen rotation or system configuration change).
  • rememberSaveable { mutableStateOf(...) }: Preserves state across both recompositions AND configuration changes / process death by saving values into the Android SavedStateHandle / Bundle.