Is there a “more correct” approach out of these two when it comes to loading resources in ui state classes?
Mike
04/25/2022, 2:12 PM
Copy code
class MyUiState {
fun getMessage(resources: Resources) = resources.getString(R.string.some_string)
@Composable
fun getMessage() = stringResource(R.string.some_string)
}
d
dimsuz
04/25/2022, 3:42 PM
the second one is more preferable in compose.
it will recompose less and also will recompose on configuration changes
👍 1
m
Michael Paus
04/25/2022, 4:11 PM
The answer will differ if you throw in multiplatform. Both approaches above are Android only.