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 AndroidSavedStateHandle/Bundle.