Edit in GitHubLog an issue

Router

The Peregrine Router is a client-side router that is designed to understand the different storefront routes within Magento 2. If using Peregrine to bootstrap your PWA, it is configured automatically. If not, the Router can be manually consumed.

Props#

NameRequiredDescription
apiBaseYesRoot URL of the Magento store (including protocol and hostname)
usingNoRouter implementation from React-Router. Possible values: BrowserRouter, HashRouter, MemoryRouter
routerPropsNoAny additional props to pass to React-Router

Example#

The following example shows the manual usage of the Router component:

Copied to your clipboard
1import ReactDOM from "react-dom";
2import { Router } from "@magento/peregrine";
3
4ReactDOM.render(
5 <Router apiBase="https://mystore.com" />,
6 document.querySelector("main")
7);
  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.