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#
Name | Required | Description |
---|---|---|
apiBase | Yes | Root URL of the Magento store (including protocol and hostname) |
using | No | Router implementation from React-Router. Possible values: BrowserRouter , HashRouter , MemoryRouter |
routerProps | No | Any additional props to pass to React-Router |
Example#
The following example shows the manual usage of the Router component:
Copied to your clipboard1import ReactDOM from "react-dom";2import { Router } from "@magento/peregrine";34ReactDOM.render(5 <Router apiBase="https://mystore.com" />,6 document.querySelector("main")7);