override val options: TabOptions
@Composable
get() {
val title = stringResource(R.string.home_tab)
val icon = rememberVectorPainter(Icons.Default.Home)
return remember {
TabOptions(
index = 0u,
title = title,
icon = icon
)
}
}
I wonder what the possible reason to add wrap the TabOptions with the remember? Because it is simple data class.
Optimisation step so we don't re-build it via just passing already remembered things?
Which effectively blocks recomposition if title changes via locale change.
a
ascii
12/19/2023, 12:45 PM
should be
remember(title, icon)
v
Vlad
12/19/2023, 12:51 PM
Why it should be remember?
a
ascii
12/19/2023, 7:46 PM
Optimisation step so we don't re-build it via just passing already remembered things?
This. In any language (?) object creation is relatively more expensive than a lookup.