Marko Novakovic
01/25/2022, 9:49 PMAnimatedNavHost
from Accompanist
composable(...) {...}
is recomposed multiple times due to animation. so every value inside the composable
lambda should be `remember`ed right? for extracting arguments it doesn't really matter because they are static but with remember
we avoid constant extraction of arguments?
what about hiltViewModel
inside composable
lambda?
is it ok to do something like this:
composable(
route = Screen.Checkout.route,
arguments = ...,
enterTransition = { forwardTransitionSharedAxisXIn() },
exitTransition = { backwardsTransitionSharedAxisXOut() },
) { backStackEntry ->
val someArg = remember { backStackEntry.arguments!!.getFloat("arg") }
val viewModel = hiltViewModel<CheckoutViewModel>(backStackEntry)
CheckoutScreen(
...
navigateUp = navController::popBackStack,
)
}
?Ian Lake
01/25/2022, 11:35 PMgetFloat
isn't ever actually going to impact your performanceMarko Novakovic
01/26/2022, 9:19 AMhiltViewModel()
in example above, how will that behaveIan Lake
01/26/2022, 3:51 PMMarko Novakovic
01/26/2022, 4:21 PM