I’m trying to understand this: <https://google.gi...
# compose
n
I’m trying to understand this: https://google.github.io/accompanist/pager/#reacting-to-page-changes
The 
PagerState.currentPage
 property is updated whenever the selected page changes. You can use the 
snapshowFlow
 function to observe changes in a flow:
Copy code
LaunchedEffect(pagerState) {
    snapshotFlow { pagerState.currentPage }.collect { page ->
        // Selected page has changed...
    }
}
Why can’t I just access the current page via
pagerState.currentPage
? Why do I have to wrap it in a
LaunchedEffect
and
snapshotFlow
?
In an example about integrating tabs with this, they directly access
PagerState.currentTab
c
Reading the value in composition is fine. That example is showing you how to turn page changes into an event stream, for things like analytics
🙏 1
n
ahh, ok thanks!