Skip to content

Commit

Permalink
#3 - Memory in a composable function
Browse files Browse the repository at this point in the history
  • Loading branch information
jhg3410 committed Jan 29, 2023
1 parent e3b74de commit 0e84634
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Button
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

@Composable
fun WaterCounter(modifier: Modifier = Modifier) {
Column(modifier = modifier.padding(16.dp)) {
var count = 0
var count by remember { mutableStateOf(0) }
Text(text = "You've had $count glasses")
Button(onClick = { count++ }, modifier = Modifier.padding(top = 8.dp)) {
Text(text = "Add one")
Expand Down

0 comments on commit 0e84634

Please sign in to comment.