How to use the @mapbox/batfish/modules/prefix-url.prefixUrl._configure function in @mapbox/batfish

To help you get started, we’ve selected a few @mapbox/batfish examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mapbox / batfish / src / webpack / router.js View on Github external
import { scrollToFragment } from './scroll-to-fragment';
import { getWindow } from './get-window';
import { changePage } from './change-page';
import { getCurrentLocation } from './get-current-location';

const {
  siteBasePath,
  siteOrigin,
  manageScrollRestoration,
  hijackLinks
} = batfishContext.selectedConfig;

// See explanation for this weirdness in prefix-url.js.
// This happens outside the component lifecycle so it can be used during
// rendering of HTML.
prefixUrl._configure(siteBasePath, siteOrigin);

type Props = {
  startingPath: string,
  startingComponent: React$ComponentType<*>,
  startingProps: Object
};

export type RouterState = {
  path: string,
  PageComponent: React$ComponentType<*>,
  pageProps: Object,
  location: BatfishLocation
};

class Router extends React.PureComponent {
  constructor(props: Props) {