# Navigating in Jetpack Compose

DevFeed: [Navigating in Jetpack Compose](<https://devfeed.tech/articles/navigating-in-jetpack-compose-25970.md>)

Original publisher: [Read original article](<https://medium.com/google-developer-experts/navigating-in-jetpack-compose-78c78d365c6a?source=rss-8efc0359e234------2>)

Author: Jossi Wolf

Published: 2021-06-07T07:52:33Z

Content type: tutorial

Language: en

Sources: [Stories by Jossi Wolf on Medium](<https://devfeed.tech/sources/stories-by-jossi-wolf-on-medium.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Mobile](<https://devfeed.tech/topics/mobile.md>), [Compose](<https://devfeed.tech/topics/compose.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [compose](<https://devfeed.tech/tags/compose.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [navigation](<https://devfeed.tech/tags/navigation.md>)

## AI overview

A tutorial on using the Navigation component with Jetpack Compose for mobile applications. It explains creating a NavController and NavHost, declaring destinations and nested graphs with the Kotlin DSL, and handling navigation routes without XML navigation graphs.

## Source excerpt

If you are working on a mobile app, chances are you need some form of navigation. Getting navigation right isn't easy with many challenges at hand: back stack handling, lifecycles, state saving and restoration and deep linking are just some of them. In this post, we'll explore the Navigation component's support for Jetpack Compose and take a look under the hood! Could I have chosen a more cliche photo? Probably not! Photo by Mick Haupt on Unsplash. Thanks, Mick!Getting started! Before getting started, we'll add a dependency on navigation-compose, the Navigation component's artifact for Compose support. https://medium.com/media/cfb5c77e0f949f64f3c820eb04e279f1/href Let's jump into the code! https://medium.com/media/abe2eb5ce3e3e78753e1c316c9684b27/href First, we create and memoize a NavController using the rememberNavController method. rememberNavController returns a NavHostController which is a subclass of NavController that offers some additional APIs that a NavHost can use. When referring to the NavController and using it later on, we will use it as NavController as we don't need to know about these additional APIs ourselves; it's just important for the NavHost. We pass this into our NavHost composable. The NavHost composable is responsible for hosting the content of the NavDestination associated with the NavBackStackEntry (we will look at the details in a bit!). The lambda we pass to the NavHost is the builder for our navigation graph. In here, we have access to a NavGraphBuilder and can construct and declare our navigation graph. This is where we declare our destinations and nested graphs. If you are coming from the "old" navigation library, this might feel a bit weird at first! There is no XML anymore, not even for the navigation graphs. Even though the Kotlin DSL has been available for a long time, it had been overshadowed by XML so far. This also means that we won't have a visual representation of the graph for the foreseeable future. The rendered view of the