It's make sense, First case navHost belong to AppNavigation function's scope and it's know nothing about caller function "AppUi", In second case AppNavigation belong to AppUi function, related to it's scope and lifecycle and we use it in second function by pass it throw.