nexora
Version:
A lightweight, production-ready JavaScript library for building user interfaces, supporting JSX.
15 lines (14 loc) • 439 B
JavaScript
import { Nexora } from '../dom/nexora';
import { navigate } from './router-provider';
/**
* Link component
* @param props - The properties for the Link component.
* @returns The Link component.
*/
export function Link({ to, children, className }) {
const handleClick = (e) => {
e.preventDefault();
navigate(to);
};
return (Nexora("a", { href: to, onClick: handleClick, className: className }, children));
}