https://kotlinlang.org logo
#compose
Title
# compose
j

Jasmin Fajkic

07/25/2022, 7:05 PM
Hello. Maybe this question is already asked but really want to see how other people manage this. I need access to navcontroller deep down in child component. I do not want to do react thing “props drill” and that every piece of app knows for navcontroller event it does not need it. Is there any better approach to pass navcontroller deep down? Local composition?
c

Chrimaeon

07/25/2022, 7:28 PM
j

Jasmin Fajkic

07/25/2022, 7:38 PM
wow wow thx 😄 … same issue bother us 😄 so props drilling is our solution passing lambda around to component which actually needs it
d

dewildte

07/25/2022, 7:58 PM
See how I pass events up with very minimal amounts of lambdas here: https://github.com/EricDw/MADPlayground
i

Ian Lake

07/26/2022, 3:46 PM
You might look at changing some of your intermediate layers to be more Slot based APIs if you find yourself reusing them in multiple different screens: https://chris.banes.dev/slotting-in-with-compose-ui/
d

dewildte

07/26/2022, 6:53 PM
@Ian Lake was this comment ☝️ directed at me?
i

Ian Lake

07/26/2022, 7:23 PM
Nope, to Jasmin. More that intermediate layers that use slot based APIs don't need to know about passing lambdas, as they work with any content 🙂
d

dewildte

07/26/2022, 7:23 PM
True
j

Jasmin Fajkic

07/26/2022, 7:25 PM
thx a lot @Ian Lake. One thing on the same note what is preferred way of sending objects as navigation params or it is better to use something like https://github.com/raamcosta/compose-destinations
i

Ian Lake

07/26/2022, 7:34 PM
As per the other thread from yesterday, don't send them at all is the best way https://kotlinlang.slack.com/archives/CJLTWPH7S/p1658736921551749?thread_ts=1658736921.551749&cid=CJLTWPH7S
3 Views