[기능구현] 링크복사 기능

Lia·2024년 1월 17일
0

링크복사 기능

  const handleCopyClipBoard = async (text) => {
    try {
      await navigator.clipboard.writeText(text);
      alert("링크가 복사되었어요.");
    } catch (err) {
      console.log(err);
    }
  };
<button 
className="retry-btn"
onClick={() => handleCopyClipBoard(`${baseUrl}${location.pathname}`)}
> 공유링크 </button>
profile
https://lia-portfolio.vercel.app/

0개의 댓글