Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to copy text in react

// copy text on button click  in react
    const [textArea, setTextArea] = useState("THis is text")
    
	const copyText = () => {
        navigator.clipboard.writeText(textArea);
    }
 
PREVIOUS NEXT
Tagged: #copy #text #react
ADD COMMENT
Topic
Name
3+6 =