Hi! I have browser app using Decompose & MVIKo...
# decompose
b
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
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
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
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.