New to Compose, but have done AWT, Swing, GWT, Web...
# compose
g
New to Compose, but have done AWT, Swing, GWT, Web (of course), and interested in Fyne (GoLang), JavaFX. In the ones I've actually used, each "component" could access the "parent component" (walk the directed graph, e.g. DOM), is that possible with compose?
n
no (at least not that I know), it is explained here : https://developer.android.com/jetpack/compose/mental-model#paradigm
a
Generally if a parent wants to make its own services available to child components, it should pass those dependencies to children as explicit parameters rather than having the children query parents for them
the characteristics of lambda capture often make explicit dependency parameters across layers unnecessary
n
an example here with scrollable : https://developer.android.com/jetpack/compose/gestures#scroll-modifiers the parent makes a
val state = rememberScrollState()
that it can pass to childs, so they can scroll to a certain point of the page for example