Predict the output
Strong skipping is on. The parent recomposes and passes the same Settings instance (an unstable class with a var). Is the child skipped?
class Settings(var darkMode: Boolean)
@Composable
fun SettingsRow(settings: Settings) {
Text(if (settings.darkMode) "Dark" else "Light")
}Hint 1 of 1
How does strong skipping compare unstable values?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Yes: the same instance passes the === check
Correct. Strong skipping compares unstable parameters by instance.
Why not the others?
- B No: unstable parameters always recompose. That was true before strong skipping.
- C No: classes with var are never skipped. Instance equality is enough under strong skipping.
- D Yes, but only if annotated @Stable. No annotation is needed for the same instance.