'Is State<T> only available for recompose in Android Studio Compose?
I have read the article State and Jetpack Compose.
I see the UI will be recomposed automatically when a State<T> variable is changed in Android Studio Compose.
Does it mean the State<T> is unique variable who can recompose UI automatically ? and must other types such as LiveData, Flow be convert to a State in order to update UI automatically?
Solution 1:[1]
Yes, you have to convert them as mentioned in the docs.
Key Point: Compose will automatically recompose from reading State objects.
If you use another observable type such as LiveData in Compose, you should convert it to State before reading it in a composable using a composable extension function like LiveData.observeAsState().
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 | Abhimanyu |

