0Pricing
Jetpack Compose Academy · Lesson

rememberCoroutineScope for Events

Launch coroutines from callbacks.

Some Work Starts on a Tap

LaunchedEffect runs as composition happens. But scrolling a list or showing a snackbar should start from a callback like onClick, not on entry.

Meet rememberCoroutineScope

A rememberCoroutineScope gives you a CoroutineScope bound to the composition. You keep it around and launch from event handlers.

val scope = rememberCoroutineScope()

All lessons in this course

  1. LaunchedEffect for Coroutines
  2. rememberCoroutineScope for Events
  3. DisposableEffect & Cleanup
  4. derivedStateOf & snapshotFlow
← Back to Jetpack Compose Academy