Does this look wrong to anyone? `LaunchedEffect(vi...
# compose
c
Does this look wrong to anyone?
LaunchedEffect(viewModel.screenState.something != null)
Should it instead be
LaunchedEffect(viewModel.screenState.something
and then do the null check inside (or outside of) the LE?
z
Id say it depends on how often you want the LaunchedEffect to run. If
.something
changes frequently for example, that might not be what youre looking for?
c
if it changes between two different non-null values, then this effect won't be run, right? is that what you want
c
Okay. I've got some thinking to do here.
s
Or just use the second alternative and do the null check inside. And do no more thinking about it 😅
y
I wonder for the first form, do you want a derivedStateOf to avoid recomposition? May not help if you use
something
elsewhere.