Can you `remember {}` a when statement? I'm tryin...
# compose
Can you
remember {}
a when statement? I'm trying something like this
Copy code
   when (someValue) {
       optionA -> {
but I get an error of "remember calls must not return Unit"
I think you want
Since you don't seem to `remember`ing anything.
Hm. Thanks for making me think harder here. I suppose you're right. And I suppose I need to read the sideEffects docs for like the 10th time. Something with sideeffects just doesn't click for me. 😭
This first line in the docs always gets me. "Composables should be side-effect free." I think I also picked up this habbit from @jim as I'm allergic to CompositionLocals and SideEffects in my code. Any time I see them I try to get rid of them. Could the first sentence in the docs be interpreted as "Composable should typically be free of side-effects, but they are necessary in some cases" ?
Well, maybe it should say. Wrapping your side effects with
removes the side effect from the composable.
Or rather, there should no side effects ran during composition.
I think that is covered by "should" (see:
❤️ 1
🤣 1
💯 1
Btw, @Colton Idle, your allergy is probably a good thing. Your code will be much better than everyone else's as a result 😇
ooof. got hit with the rfc link. 😂 @jim appreciate it though. I guess like I said, Im just very "against" having these in my app so I typically try other things first. In this case... it looks like its necessarythough. @Dominaezzz thanks for your help. I went for LaunchedEffect and it did what I expected. 🙏