Tlaster
08/03/2022, 7:34 AMonValueChange
, but when we build a complex screen, we will get a lot of states and lots of onValueChange
, there will be many parameters for the composable method, is there any optimization we can do to reduce the parameters?
• If we have onValueChange
inside a very deep composable, it will pass all the way up to the top screen to actually handle the onValueChange
, is there a better way to do it instead of passing it all the way up to the top screen?Filip Wiesner
08/03/2022, 7:56 AMTextFieldValue
which groups several onChange
candidates together (in this case text
, selection
and composition
) but this one is hard to answer without context.
2. This problem can be partly solved by using the "slot pattern" so you don't pass the lambda down the tree through parameters.
Leland Richardson talks about it in his "Thinking in Compose" video (somewhere around 9:30 mark)Tlaster
08/03/2022, 9:59 AM