INNER CODE UNIT · JavaScript
handleCopy
christopherkarani/Wax · Resources/website/src/pages/index.js:98
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);
useEffect(() => {
const el = ref.current;