---
title: "remember"
description: "Remember the value produced by [calculation]. [calculation] will only be evaluated during the
composition. Recomposition will always return the value produced by composition."
type: "composable"
---

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


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

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


```kotlin
@Composable
public inline fun <T> remember(crossinline calculation: @DisallowComposableCalls () -> T): T
```


Remember the value produced by `calculation`. `calculation` will only be evaluated during the
composition. Recomposition will always return the value produced by composition.



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


```kotlin
@Composable
public inline fun <T> remember(
    key1: Any?,
    crossinline calculation: @DisallowComposableCalls () -> T,
): T
```


Remember the value returned by `calculation` if `key1` compares equal (`==`) to the value it had
in the previous composition, otherwise produce and remember a new value by calling `calculation`.



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


```kotlin
@Composable
public inline fun <T> remember(
    key1: Any?,
    key2: Any?,
    crossinline calculation: @DisallowComposableCalls () -> T,
): T
```


Remember the value returned by `calculation` if `key1` and `key2` are equal (`==`) to the values
they had in the previous composition, otherwise produce and remember a new value by calling
`calculation`.



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


```kotlin
@Composable
public inline fun <T> remember(
    key1: Any?,
    key2: Any?,
    key3: Any?,
    crossinline calculation: @DisallowComposableCalls () -> T,
): T
```


Remember the value returned by `calculation` if `key1`, `key2` and `key3` are equal (`==`) to
values they had in the previous composition, otherwise produce and remember a new value by
calling `calculation`.



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


```kotlin
@Composable
public inline fun <T> remember(
    vararg keys: Any?,
    crossinline calculation: @DisallowComposableCalls () -> T,
): T
```


Remember the value returned by `calculation` if all values of `keys` are equal (`==`) to the
values they had in the previous composition, otherwise produce and remember a new value by
calling `calculation`.




