redirectDocument: redirectDocument (loader/action helper)

View source: R/helpers.R

redirectDocumentR Documentation

redirectDocument (loader/action helper)

Description

https://reactrouter.com/api/utils/redirectDocument

Usage

redirectDocument(to)

Arguments

to

Character. Destination path or absolute URL.

Details

Returns a JS loader function that performs a document redirect to to – a full page reload, as opposed to the client-side navigation that 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 window.jsmodule['@/reactRouter'].helpers.redirectDocument(to) from your own JS() string.

Value

A JS expression suitable for the loader argument of Route.

Examples

## Not run: 
Route(
  path = "/docs",
  loader = redirectDocument("/static/docs/index.html"),
  element = NULL
)

## End(Not run)


reactRouter documentation built on May 10, 2026, 5:07 p.m.