Work that changes the world outside (loading data, a listener, a snackbar) belongs in an effect handler, which starts after a composition is applied and stops when its call site leaves:
| Compose API | When it runs | Closest React idiom |
|---|---|---|
| LaunchedEffect(key) | coroutine on enter; restarted when a key changes | useEffect(fn, [key]) |
| DisposableEffect(key) | setup, then onDispose before a restart or on leave | useEffect with cleanup |
| SideEffect | after every applied recomposition | useEffect(fn), no array |
| rememberCoroutineScope() | coroutines launched from event handlers | work started in a handler |