<div class='type'>Composable Function</div>


<a id='references'></a>



<h2 id="sideeffect-effect">SideEffect</h2>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
@Composable
@ExplicitGroupsComposable
public fun SideEffect(effect: () -> Unit)
```


Schedule `effect` to run when the current composition completes successfully and applies changes.
`SideEffect` can be used to apply side effects to objects managed by the composition that are not
backed by `snapshots` so as not to leave those
objects in an inconsistent state if the current composition operation fails.

`effect` will always be run on the composition's apply dispatcher and appliers are never run
concurrent with themselves, one another, applying changes to the composition tree, or running
`RememberObserver` event callbacks. `SideEffect`s are always run after `RememberObserver` event
callbacks.

A `SideEffect` runs after **every** recomposition. To launch an ongoing task spanning potentially
many recompositions, see `LaunchedEffect`. To manage an event subscription or other object
lifecycle, see `DisposableEffect`.