lazyColumn
HTML-based lazy column implementation.
Use this composable to display large amounts of elements on screen. Items are only loaded as they appear on screen.
Elements are loaded from top to bottom, in the same order as they are declared in block.
Example
Lazily display a large list of users, unreferencing each from its by UserId
by calling requestUser()
:
@Composable
fun ShowUsers(users: List<UserId>) {
LazyColumn {
items(users) { userId ->
var user by remember { mutableStateOf<User?>(null) }
LaunchedEffect(userId) {
user = requestUser(userId)
}
user?.also { Show(it) }
}
}
}
Content copied to clipboard