rememberGleamNavigator

Creates and remembers a GleamNavigator for use with Gleam navigations.

This function creates a new GleamNavigator and stores it in the composition context using remember. This ensures that the same instance of the navigator is used throughout the composition hierarchy, even if the composable is recomposed.

The navigator can be used to navigate between different Gleam screens by calling methods like navigate and popBackStack.

Example:

@Composable
fun MyGleamScreen(navigator: GleamNavigator) {
Button(onClick = { navigator.navigate("SecondScreen") }) {
Text("Go to Second Screen")
}
}

@Composable
fun MyGleamApp() {
val navigator = rememberGleamNavigator()
MyGleamScreen(navigator)
}

Return

A new instance of GleamNavigator associated with the current composition.