# compose

Valentin Volodarskiy

11/06/2023, 5:28 AM
Hi everyone! I have one question about LaunchedEffect & DisposableEffect. I have seen in many examples that we have to pass lifecycle and context (if we use them) as a key to close the effect if the owner of the lifecycle or context has changed. But do we really need to pass them as a key? Because according to the documentation LaunchedEffect and DisposableEffect will be closed and restarted if one of the keys changes OR the effect leaves the composition. So in general we will only close and restart this effect when the activity has recreated itself, which means that the LaunchedEffect/DisposableEffect will leave composition even without lifecycle or context as a key. Am I misunderstanding this? Thanks in advance to everyone for any clarification on this question! :)