Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

describe how to use Redirect's options prop #998

Merged
merged 2 commits into from
Mar 18, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,8 @@ const SomePage = () => {
}
```

In similar fashion to `navigate`'s second argument: `navigate(_, { replace: true })`, we can *replace* the top item of the browser history stack (instead of pushing a new one). We achieve this by using `Redirect`'s `options` prop. Above example could be converted to `<Redirect to={routes.home()} options={{ replace: true }}/>` to have this effect.

## Code-splitting

By default, the router will code-split on every Page, creating a separate lazy-loaded webpack bundle for each. When navigating from page to page, the router will wait until the new Page module is loaded before re-rendering, thus preventing the "white-flash" effect.
Expand Down