UNPKG

routeria

Version:

A router package for react

13 lines (12 loc) 336 B
export const usePath = () => { const moveTo = (pathname) => { if (pathname === window.location.pathname) { return; } window.history.pushState({ path: pathname }, "", pathname); window.dispatchEvent(new PopStateEvent("popstate")); }; return { moveTo, }; };