Closed pshrmn closed 5 years ago
When using router.url with no name property, the URL returned will have no pathname component. If the history is configured with a base, that will not be included either.
router.url
pathname
base
const url = router.url({ hash: "comments" }); // url = "#comments"
When navigating using a URL with no pathname component, the corresponding location will re-use the current location's pathname.
const router = createRouter(inMemory, routes, { history: { locations: [{ url: "/initial-location" }] } }); const url = router.url({ hash: "comments" }); router.navigate({ url }); const { response } = router.current(); // response.location = { pathname: "/initial-location", hash: "comments", ... }
When using
router.url
with no name property, the URL returned will have nopathname
component. If the history is configured with abase
, that will not be included either.When navigating using a URL with no
pathname
component, the corresponding location will re-use the current location'spathname
.