Chachako
02/22/2021, 7:39 AMremember. Should I wrap remember in all object initialization places?Halil Ozercan
02/22/2021, 8:33 AMcomposable functions as callback parameters that you pass to any other framework or library. You do not exactly have full control over how many times or when they are called. These functions are invoked whenever a related state changes.
However, remember concept is an escape for you to have a predictable, compose-friendly storage. It literally remembers the result of whatever function is passed to it in subsequent invocations. It also supports invalidators through key parameters. If any key changes, remember forgets the previous result and recalculates.
I probably botched the explanation but Adam Powell might already have given a good answer in this channel, somewhere. Please don't @ him.Halil Ozercan
02/22/2021, 8:35 AMremember if there is something that needs to be remembered in the following invocations of your composable. Also "remember" that any variable that you use in remember is a good candidate to be an invalidator key .Chachako
02/22/2021, 10:40 AMSideEffect and direct call?
I found that the following codes will also print when the composable function is recombined:
@Composable fun a() { println("hi") }
vs
@Composable fun a() {
SideEffect {
println("hi")
}
}Zach Klippenstein (he/him) [MOD]
02/22/2021, 3:32 PMShakil Karim
02/22/2021, 4:50 PMZach Klippenstein (he/him) [MOD]
02/22/2021, 5:07 PMZach Klippenstein (he/him) [MOD]
02/22/2021, 5:08 PMZach Klippenstein (he/him) [MOD]
02/22/2021, 5:09 PMZach Klippenstein (he/him) [MOD]
02/22/2021, 5:10 PMZach Klippenstein (he/him) [MOD]
02/22/2021, 5:13 PM