% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hooks.R
\name{useNavigate}
\alias{useNavigate}
\title{useNavigate}
\usage{
useNavigate(into = NULL, as = "children", render = NULL, ...)
}
\arguments{
\item{into}{A component (HTML tag or \pkg{shiny.react}-based element)
that will receive the hook value as the specified prop.}

\item{as}{Character. The name of the component's prop to inject the hook
value into. Defaults to \code{"children"}.}

\item{render}{Optional \code{\link{JS}} function \code{(value) => ReactNode}
used in place of \code{into}/\code{as}.}

\item{...}{Additional props to pass to the component.}
}
\description{
\url{https://api.reactrouter.com/v7/functions/react-router.useNavigate.html}
}
\details{
Calls the \code{useNavigate()} hook and passes the navigate function
to \code{render} (or injects it \code{as} a prop of \code{into}).
The navigate function has signature \code{navigate(to, options?)}, e.g.
\code{navigate("/about")} or \code{navigate(-1)} to go back.

Because the hook returns a function (not a value), the \code{render}
form is the natural way to use it:
\preformatted{
  useNavigate(render = JS(
    "nav => <button onClick={() => nav('/about')}>Go</button>"
  ))
}
}
