% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/helpers.R
\name{redirectDocument}
\alias{redirectDocument}
\title{redirectDocument (loader/action helper)}
\usage{
redirectDocument(to)
}
\arguments{
\item{to}{Character. Destination path or absolute URL.}
}
\value{
A \code{\link{JS}} expression suitable for the \code{loader}
  argument of \code{\link{Route}}.
}
\description{
\url{https://reactrouter.com/api/utils/redirectDocument}
}
\details{
Returns a \code{\link{JS}} loader function that performs a \emph{document}
redirect to \code{to} -- a full page reload, as opposed to the client-side
navigation that \code{\link{redirect}} performs. Use when navigating to a
URL outside the router's control (e.g. a server-rendered page) so the
browser fully unloads the SPA.

For conditional document redirects inside a custom loader/action, call
\code{window.jsmodule['@/reactRouter'].helpers.redirectDocument(to)} from
your own \code{JS()} string.
}
\examples{
\dontrun{
Route(
  path = "/docs",
  loader = redirectDocument("/static/docs/index.html"),
  element = NULL
)
}

}
