Is there a “more correct” approach out of these tw...
# compose
m
Is there a “more correct” approach out of these two when it comes to loading resources in ui state classes?
Copy code
class MyUiState {

    fun getMessage(resources: Resources) = resources.getString(R.string.some_string)

    @Composable
    fun getMessage() = stringResource(R.string.some_string)
}
d
the second one is more preferable in compose. it will recompose less and also will recompose on configuration changes
👍 1
m
The answer will differ if you throw in multiplatform. Both approaches above are Android only.