Home > OS >  Jetpack compose and fragments
Jetpack compose and fragments

Time:08-01

If there is some lifecycle related event like unSubscribe or dispose, how is it possible to use compose without fragments' lifecycle?

CodePudding user response:

If you need to observe lifecycle events on the fragment or activity, you can use LocalLifecycleOwner.

If you want to subscribe to some observable and ensure it gets disposed when the composable leaves the comosition, you can use Disposable Effect.

  • Related