Colton Idle
06/18/2021, 9:16 PM@Composable
fun MyComposable(changed: () -> Unit)`
and I want to invoke the lambda passed in during a click would I do?
1. Modifier.clickable { changed() }
2. Modifier.clickable { changed }
3. Modifier.clickable { changed.invoke() }
Number 1 and 3 seem to work, but I feel like I can never remember what to use and when to use it. Any tips?Halil Ozercan
06/18/2021, 9:22 PMchanged?.invoke()
which is not a good practice imo but possible.
Number 2 is kind of nothing. It is essentially equivalent to modifier.clickable { 4 }
. Ofc it might have side effects if changed
has a custom getter but it isn't in your situation.Halil Ozercan
06/18/2021, 9:23 PMArkadii Ivanov
06/18/2021, 9:23 PMModifier.clickable(changed)
Colton Idle
06/18/2021, 10:21 PMArkadii Ivanov
06/18/2021, 10:32 PMColton Idle
06/19/2021, 1:47 AMDesmond Teo
06/19/2021, 1:51 AM.clickable(onClick = changed)
Colton Idle
06/19/2021, 1:56 AMModifier.clickable(changed)
? If so then I will file a bug that in my scenario it's not working apparently.Arkadii Ivanov
06/19/2021, 8:31 AM