import { AnchorHTMLAttributes } from "react";
interface IAnchorProps extends AnchorHTMLAttributes {
useRef?: React.LegacyRef
}
/** 阻止a標籤的href產生網頁跳轉 */
export default function A(props: IAnchorProps) {
const { useRef, children, onClick } = props;
function handleClick(event: React.MouseEvent) {
event.preventDefault(); // 阻止默认点击行为
onClick && onClick(event);
}
return (
{children}
);
}