locationUtils.js 318 B

12345678910
  1. import { createLocation } from "history";
  2. export const resolveToLocation = (to, currentLocation) =>
  3. typeof to === "function" ? to(currentLocation) : to;
  4. export const normalizeToLocation = (to, currentLocation) => {
  5. return typeof to === "string"
  6. ? createLocation(to, null, null, currentLocation)
  7. : to;
  8. };