I'm trying to make the following variable, selectedView, mutable so that I can set the current Composable View dynamically.
var selectedView :@Composable () -> Unit =  { testView() }
I'm passing back the Composable function and the following code works, but I can't figure out how to make the variable selectedView updateable. This would work if selectedView variable was mutable.
@Composable
fun testView1() {
    Text("It works! 111")
}
...
    
val navBarItems = listOf(
    NavBarItem("Invite", Icons.Outlined.Send) { testView1() },
    NavBarItem("Messages", Icons.Outlined.Menu) { testView2() },
    NavBarItem("Groups", Icons.Outlined.AccountCircle) { testView3() }
)
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun CurrentView() {
    
    var selectedView :@Composable () -> Unit =  { testView() }
    Scaffold(
        bottomBar = {
            CustomNavBar(navBarItems){
                selectedView  = it
            }
        }
    )
    {
        Box(modifier = Modifier
            .fillMaxSize()
            .padding(it), contentAlignment = Alignment.Center) {
            selectedView?.let { it1 -> it1() }
        }
    }
}
Any assistance would be greatly appreciated.