% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/helpers.R
\name{replaceResponse}
\alias{replaceResponse}
\title{replaceResponse (loader/action helper)}
\usage{
replaceResponse(to)
}
\arguments{
\item{to}{Character. Destination path.}
}
\value{
A \code{\link{JS}} expression suitable for the \code{loader}
  argument of \code{\link{Route}}.
}
\description{
\url{https://reactrouter.com/api/utils/replace}
}
\details{
Returns a \code{\link{JS}} loader function that performs a \emph{replace}
navigation to \code{to} -- same as \code{\link{redirect}}, but the new
entry replaces the current one in the history stack instead of pushing
a new one. Use for "alias" routes where the original URL should not
remain in the user's back-history.

Renamed from \code{replace()} to avoid masking \code{base::replace}.
This mirrors the \code{dataResponse()} naming for the same reason.

For conditional replacements inside a custom loader/action, call
\code{window.jsmodule['@/reactRouter'].helpers.replace(to)} from your own
\code{JS()} string.
}
\examples{
\dontrun{
Route(path = "/legacy", loader = replaceResponse("/new"), element = NULL)
}

}
