Fabio Berta01/17/2023, 9:28 AM
variable changes. I see two ways of achieving this, either have a
and inside subscribe to changes in the state with
or have a
which then executes whenever the variable changes. Now I don't actually need a coroutine scope for my effect so the second option seems weird to me because I'm not using the provided scope. The first option looks a bit fishy because of the
as the key for the effect. What's the correct way to do this? Or maybe I'm doing something wrong from the get go? Thanks!
K Merle01/17/2023, 10:32 AM
Fabio Berta01/17/2023, 10:49 AM
K Merle01/17/2023, 10:54 AM
also takes a key and reacts to change.
Stylianos Gakis01/17/2023, 10:57 AM
to trigger side-effects is a good idea. the lambda passed into it as far as I understand may be triggered more than you think, it’s just that the returning `State`’s value is not changes as often, leading to the performance benefits of it. Unless I am misunderstanding what you mean by side effects here Fabio. It may be useful to tell us what you want to do with that change.
Fabio Berta01/17/2023, 11:01 AM
on depending on some state
is not the right call
Ben Trengrove [G]01/17/2023, 9:59 PM
ste01/18/2023, 1:39 PM
doesn't seem cheap. However, when it comes to invoke
, the samples/demos always wrap that in
(so it ends up launching a lot of times when something like a drag gesture occurs)...
Stylianos Gakis01/18/2023, 2:19 PM
Zach Klippenstein (he/him) [MOD]01/18/2023, 4:33 PM
Fabio Berta01/20/2023, 1:01 PM
K Merle01/20/2023, 1:03 PM
Zach Klippenstein (he/him) [MOD]01/20/2023, 10:21 PM
Fabio Berta01/20/2023, 10:39 PM
Zach Klippenstein (he/him) [MOD]01/21/2023, 1:56 AM
is way more lightweight.