Peter Mandeljc
02/21/2023, 10:03 AMremember
, matter? Should 2nd code be preferred?
// 1st example
var shouldShowOnboarding by remember { mutableStateOf(true) }
Surface(modifier) {
if (shouldShowOnboarding) {
OnboardingScreen()
} else {
Greetings()
}
}
// 2nd example
Surface(modifier) {
var shouldShowOnboarding by remember { mutableStateOf(true) }
if (shouldShowOnboarding) {
OnboardingScreen()
} else {
Greetings()
}
}
Csaba Szugyiczki
02/21/2023, 10:16 AMshouldShowOnboarding
from a higher level then do not hoist it, leave it as close to the usage point as possible.Peter Mandeljc
02/21/2023, 10:17 AMCsaba Szugyiczki
02/21/2023, 10:19 AMPeter Mandeljc
02/21/2023, 10:22 AMCsaba Szugyiczki
02/21/2023, 10:27 AMshouldShowOnboarding
was a parameter of SurfacePeter Mandeljc
02/21/2023, 11:31 AMCsaba Szugyiczki
02/21/2023, 12:13 PM