@nexusui/components
Version:
These are custom components specially-developed for NexusUI applications. They will make your life easier by giving you out-of-the-box implementations for various high-level UI elements that you can drop directly into your application.
2 lines (1 loc) • 329 B
JavaScript
import{useState as r,useRef as t,useEffect as e}from"react";function c(){const[c,o]=r(!1),n=t(),a=t(!1);e((()=>(a.current=!0,()=>{a.current=!1})),[]);return{copy:async r=>{try{o(!0),clearTimeout(n.current),n.current=setTimeout((()=>{a&&o(!1)}),1200),navigator.clipboard.writeText(r)}catch(r){}},isCopied:c}}export{c as default};