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
Navigation Options
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
- Prefer
linkwithtofor user-clickable navigation. Reserveuse_navigatefor programmatic navigation triggered by events or side effects. - Use
replace=True(the default) when navigating in response to a state change to avoid polluting the browser history. - Pair with
routerandrouteto define the route structure thatuse_navigatetargets.
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