-
-
Save skydoves/565ac648ba8f464630c73097039848d5 to your computer and use it in GitHub Desktop.
user_profiles_state_hoisting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun UserProfiles( | |
userList: List<User>, | |
onUserClick: (User) -> Unit | |
) { | |
// Composable logic here | |
} | |
@Composable | |
fun ParentComposable(viewModel: UserViewModel = viewModel()) { | |
val userList by viewModel.userList.collectAsStateWithLifecycle() | |
UserProfiles( | |
userList = userList, | |
onUserClick = { user -> viewModel.onUserClick(user) } | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment