I’m using the Accompanist `HorizontalPager` and I’...
# compose
m
I’m using the Accompanist
HorizontalPager
and I’ve noticed that doing something like,
Copy code
val scope = rememberCoroutineScope()
val pagerState = rememberPagerState()
...
Tab (
    ...
    onClick = { scope.launch { pagerState.animateScrollToPage(index) } }
    ...
)
feels like a bit of an imperative programming anti-pattern compared to declaratively creating an
AnimatedContent
as described in the docs. I assume it’s doing something similar under the hood anyway, and this is just a convenience function, so it’s ok?
c
This is the correct way to to do this.