I'm just getting started with compose.. I want to ...
# compose
t
I'm just getting started with compose.. I want to interop with Flow.. But this doesn't render a list:
Copy code
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)

    (view as ComposeView).setContent {
        view.setContent {
            MaterialTheme {
                GenreList(genreRepository.getGenres(GenreQuery.All()))
            }
        }
    }
}


@Composable
fun GenreList(genres: Flow<List<Genre>>) {
    val genreState = genres.collectAsState(initial = emptyList())
    LazyColumnFor(
        items = genreState.value,
        itemContent = { genre ->
            Text(text = genre.name)
        }
    )
}
If I pass in a (populated)
List<Genre>
instead of a
Flow<List<Genre>>
, things work OK
Nevermind, I'm just dumb.
Copy code
(view as ComposeView).setContent {
            view.setContent {
🏫 1