Skip to contents

Usage

replaceResponse(to)

Arguments

to

Character. Destination path.

Value

A JS expression suitable for the loader argument of Route.

Details

Returns a JS loader function that performs a replace navigation to to – same as 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 replace() to avoid masking base::replace. This mirrors the dataResponse() naming for the same reason.

For conditional replacements inside a custom loader/action, call window.jsmodule['@/reactRouter'].helpers.replace(to) from your own JS() string.

Examples

if (FALSE) { # \dontrun{
Route(path = "/legacy", loader = replaceResponse("/new"), element = NULL)
} # }