INNER CODE UNIT · JavaScript

CopyButton

christopherkarani/Wax · Resources/website/src/pages/index.js:96

function CopyButton({ text }) {
  const [copied, setCopied] = useState(false);
  const handleCopy = () => {
    navigator.clipboard.writeText(text).catch(() => {});
    setCopied(true);
    setTimeout(() => setCopied(false), 2000);
  };
  return (
    <button className={`copy-btn${copied ? " copied" : ""}`} onClick={handleCopy}>
      {copied ? "copied!" : "copy"}
    </button>
  );
}

function PerfSection() {
  const [animated, setAnimated] = useState(false);
  const ref = useRef(null);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…