Francis Mariano
04/04/2023, 2:37 PM@Composable
internal fun BasicContent(component: BasicComponent) {
val state by component.states.collectAsState()
OtherComposable(state.title, onClick = component::onClicked) // approach 1
OtherComposableWithComponent(component) // approach2
OtherComposableWithState(state) // approach3
}
Is it wrong use the second and third approach???Arkadii Ivanov
04/04/2023, 3:04 PMs3rius
04/04/2023, 9:31 PMOtherComposableWithComponent
into a non-skippable function because component
is probably unstable. This can cause performance issues.
I noticed the same when I investigated why an animated transition between two components lagged, and found out that both UIs re-rendered on each frame because of that.
I started adopting approach 1.