'UI doesn't update when mutableStateOf changes

I have @Composable item - ThumbButton and Text which displays current likes number. When I click button I want to increment likes number. I don't know why it doesn't work

val likesCounter = remember { mutableStateOf(0)}

    Row(
        modifier = Modifier.wrapContentSize(),
        verticalAlignment = Alignment.CenterVertically
    ) {
        ThumbButton(
            iconSize = sizeButton,
            isSelected = isActive,
            onClick = { likesCounter.value = likesCounter.value+1 }
        )

        Text(text = "($likesCounter)")
    }


Solution 1:[1]

Try referencing the value property while displaying it?

Text(text = "(${likesCounter.value})")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Richard Onslow Roper