Кнопка копирования

PHOTO EMBED

Tue Sep 14 2021 08:37:31 GMT+0000 (UTC)

Saved by @happy_cutman #react.js

const [isCopySuccess, setIsCopySuccess] = useState<boolean>(false)
const copyTextRef = useRef(null)

   const copyToClipBoard = async () => {
  {  try {
       await navigator.clipboard.writeText(copyTextRef.current.innerHTML)
      setIsCopySuccess(true)
       setTimeout(function() {
         setIsCopySuccess(false)
       }, 2500)
     } catch (err) {
       setIsCopySuccess(false)
     }
  }
content_copyCOPY