https://kotlinlang.org logo
#decompose
Title
# decompose
b

bartosz.malkowski

07/29/2022, 1:08 PM
Hi! I have browser app using Decompose & MVIKotlin. I have to pass
HttpClient
to many components and I'm curious how to do it in right way. I can use global
val
, but somehow I feel it is not right way (I'm old Java developer 😉) I tried to use Koin, but I'm not sure it is not too big tool for that small thing. Especially I'm not sure if it is possible to put components into Koin modules. Any advice? 🙂 Thanks in advance!
a

Arkadii Ivanov

07/29/2022, 1:12 PM
Hello! Personally I would still pass it via constructor to every component, just to make it explicit. But you may also like creating a custom ComponentContext - https://arkivanov.github.io/Decompose/component/custom-component-context/
b

bartosz.malkowski

07/29/2022, 1:18 PM
How, the h…, I missed this feature?!?!?! Almost all my components will use HTTP client, so custom Context sounds promising. But when more experienced colleague says "personally I would", then new doubts arise. Thanks a lot!
a

Arkadii Ivanov

07/29/2022, 1:20 PM
That's totally fine because I don't care much about boilerplate, or lines of code. But exactly because some people do care, there are things like custom ComponentContext, DSL in MVIkotlin, etc.
7 Views