~repos /edge-city

#react#js#ssr

git clone https://pyrossh.dev/repos/edge-city.git

edge-city is a next level meta-framework for react that runs only on edge runtimes



lib/link.js



import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { useRouter } from "./router";
const Link = (props) => {
const router = useRouter();
return _jsx("a", {
...props,
onMouseOver: (e) => {
// Simple prefetching for now will work only with cache headers
// fetch(getCssUrl(props.href));
// fetch(getCssUrl(props.href).replace("css", "jsx"));
},
onClick: (e) => {
e.preventDefault();
if (props && props.onClick) {
props.onClick(e);
}
router.push(props.href);
},
})
}
export const StyleLink = ({ children, className, activeClassName, ...props }) => {
const { pathname } = useRouter();
const classNames = pathname === props.href ? [activeClassName, className] : [className];
return _jsx(Link, {
children,
className: classNames,
...props,
})
}
export default Link;