Skip to main content
useNavigate(): (options: { to: string; props?: Record<string, string> }) => void;

Returns

A function that triggers navigation. The host app defines how navigation requests are handled.
options
object
required
Navigation options.

Usage

const body = (props) => {
    const navigate = useNavigate()

    return Button("View Details", () => {
        navigate({ to: "DetailView", props: { id: props.itemId } })
    })
}
const body = (props) => {
    const navigate = useNavigate()

    return Button("Open Profile", () => {
        navigate({
            to: "ProfileScreen",
            props: {
                userId: props.userId,
                tab: "settings"
            }
        })
    })
}

Notes

  • useNavigate must be called inside a component body function, not at the top level.
  • The to value and how navigation is handled depends entirely on the host app’s navigation setup. The BindJS runtime forwards the request to the native navigation handler.
  • All prop values must be strings.

See Also

  • useAction — dispatch arbitrary actions to the host app