Open eric-ampire opened 3 years ago
It would be something like:
val signing = viewModel.collectAsState(SignInViewState::signing)
val derivedSomething = derivedStateOf { signing + foo }
val rememberSomething = remember(signing) { Foo(signing) }
LaunchedEffect(signing) {
// Do something here.
}
Basically, you collect the item itself and then use existing Jetpack Compose APIs to make it one-shot. Does that make sense?
The idea is to navigate to another view when an operation is successful, or to display a Snackbar if there is an error
@eric-ampire you would still do it with standard Compose constructrs
val signing = viewModel.collectAsState(SignInViewState::signing)
val snackbarHostState = remember { SnackbarHostState() }
LaunchedEffect(signing) {
if (signing.foo) {
snackbarHostState.showSnackbar(
message = "Hello World,
)
}
}
Is there an equivalent of this piece of code when using
com.airbnb.android:mavericks-compose