diff --git a/README.md b/README.md index 93f4fd0..0d723d0 100644 --- a/README.md +++ b/README.md @@ -97,15 +97,17 @@ the `safeNavRoute()` function if we are using annotation. In the following code, we navigate to the `SettingsNavDestination`: ```kotlin -composable(navDestination = HomeNavDestination) { - HomeScreen( - navigateToSettings = { - navAction.navigate( - SettingsNavDestination.navRoute() - ) - }, - ) -} +val navAction = rememberNavAction(navController) +NavHost(navController = navController, startNavDestination = HomeNavDestination) { + composable(navDestination = HomeNavDestination) { + HomeScreen( + navigateToSettings = { + navAction.navigate( + SettingsNavDestination.navRoute() + ) + }, + ) + } ``` ### Navigate with arguments diff --git a/docs/usage.md b/docs/usage.md index dc98402..45345f7 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -69,15 +69,17 @@ the `safeNavRoute()` function if we are using annotation. In the following code, we navigate to the `SettingsNavDestination`: ```kotlin -composable(navDestination = HomeNavDestination) { - HomeScreen( - navigateToSettings = { - navAction.navigate( - SettingsNavDestination.navRoute() - ) - }, - ) -} +val navAction = rememberNavAction(navController) +NavHost(navController = navController, startNavDestination = HomeNavDestination) { + composable(navDestination = HomeNavDestination) { + HomeScreen( + navigateToSettings = { + navAction.navigate( + SettingsNavDestination.navRoute() + ) + }, + ) + } ``` ## Navigate with arguments