use_navigate

use_navigate is a hook that returns a function to trigger single page application (SPA) navigation within Deephaven. For declarative navigation, consider using link with the to prop instead.

Note

Deephaven and all custom components share the path. Avoid using routers, the path, path parameters, and navigation in shared components to prevent conflicts. Do not use the route segment /-/ in your application path as it is reserved for internal use by Deephaven.

Example

Use use_navigate together with use_path and use_query_params to build a simple navigation system that updates the path and displays query parameters.

Recommendations

  1. Prefer link with to for user-clickable navigation. Reserve use_navigate for programmatic navigation triggered by events or side effects.
  2. Use replace=True (the default) when navigating in response to a state change to avoid polluting the browser history.
  3. Pair with router and route to define the route structure that use_navigate targets.

API Reference

Get a function to navigate to a new URL within the widget's route space.

Returns: A navigate function navigate(path, query_params, fragment, replace) -> None