useState, useEffect, useTransition
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
get: () => globalThis._EDGE_ROUTER_STATE_,
globalThis._EDGE_ROUTER_STATE_ = v;
export const usePage = () => {
const { history, router } = state.get();
const [_, startTransition] = useTransition();
const [pathname, setPathname] = useState(history.location.pathname);
const Page = router.lookup(pathname) || router.lookup("/_404");
return history.listen(({ location }) => {
// this causes 2 renders to happen but stops jitter or flash due to React.lazy
setPathname(location.pathname);
export const useRouter = () => {
const { history, params } = state.get();
pathname: history.location.pathname,
query: new URLSearchParams(history.location.search),
replace: history.replace,
forward: history.forward,
reload: () => window.location.reload(),