I've got a silly question. I have a state that hav...
# compose-desktop
a
I've got a silly question. I have a state that have a default value passed as parameter. In general, I want to be managed inside the component, but if the default value is changed, I wand inner state to be reset to the new default value. Which is the simplest way to do that?
Construct like this works, but it looks ugly:
Copy code
var cachedValue by remember { mutableStateOf(initialViewPoint) }
    var viewPoint by remember { mutableStateOf(initialViewPoint) }

    if (cachedValue != initialViewPoint) {
        viewPoint = initialViewPoint
        cachedValue = initialViewPoint
    }
k
This is better directed to #compose
a
OK