What's the pattern to pass state up the component tree? Use case: I have some deep child scrollable component, and I want to display a scroll position in the parent. I guess I should pass the mutable state down to this component and observe it in the parent, correct?
👌 2
h
Halil Ozercan
08/30/2020, 11:13 AM
yes, that's one right way to do it. If I'm not mistaken
ScrollableColumn
does exactly what you described.
👆 1
d
dimsuz
08/30/2020, 11:25 AM
great, thanks!
d
Davide Giuseppe Farella
08/30/2020, 12:17 PM
You also can pass a lambda that updates it
Copy code
MyChild(onScroll = { scrollPosition.value = it })
fun MyChild(onScroll: (Int) -> Unit)