What would be a good approach to use scaffold? 1....
# compose
n
What would be a good approach to use scaffold? 1. Independent scaffold for each navigation destination? 2. Single scaffold for all the similar destinations? I only need to change the title of the 
topbar
 for each navigation destination. If I use a single scaffold then how can I change the title of the topbar? One way would be to store the name as a state and pass a lambda to each destinations that they can invoke to change the name of the topbar. Something like this,
Copy code
var topBarTitle by remember { mutableStateOf("Title") }

Scaffold(
    topBar = { TopAppBar( title = Text(title), ... ) }            
){
    NavigationDestination{ title -> 
        topBarTitle = title
    }
}

@Composable
fun NavigationDestination(changeTopbarName: (String) -> Unit){
    changeTopbarName("Some Title")
    ...    
}
Would using
LaunchedEffect
make sure that the
changeTopbarName
function will only be executed during composition and not on each recompositions? Would it be a good approach?