Portfolio website written with Next.js
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
wychdev-nextjs/components/hiddenemail.tsx

22 lines
397 B

import React, { useState, useEffect } from "react";
const HiddenEmail = ({
email,
alt,
althref,
}: {
email: string;
alt: string;
althref: string;
}) => {
const [visible, setVisible] = useState(false);
useEffect(() => {
setVisible(true);
}, []);
return (
<a href={visible ? `mailto:${email}` : althref}>{visible ? email : alt}</a>
);
};
export default HiddenEmail;