v0.20.230 - 6.5 / 6.1

<Navigate .../>

Navigates to a new location from JSX. When rendered, it changes the URL to path and then renders its children (if any) at the destination. Useful for conditional redirects inside a Route tree.

# Attributes

nametypedescription
pathstringdestination URL. Relative paths are resolved against the current location.
params?key-value pairs objectreplaces :name params in path for their URI-encoded values, same as A and Route.
replace?boolean [false]use history.replaceState so no new history entry is added.
scroll?booleanwhether to scroll to the hash (if any) after navigating.
delay?numbermilliseconds to wait before navigating. Useful to show a message before redirecting.
children?anyoptional content rendered in place during the navigation (for example a "Redirecting…" notice when combined with delay).

# Snippet

# Programmatic navigation

Outside JSX, import navigate from pota/use/location to navigate imperatively. It accepts the same options.