Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import React from 'react'
  2.  
  3. const ReactCopy = () => {
  4.  
  5. let toCopy
  6.  
  7. const onLocalClick = e => {
  8. e.preventDefault()
  9. toCopy.select()
  10. let onClipboard = toCopy.value
  11. onClipboard = document.execCommand('copy')
  12. }
  13.  
  14. return (
  15. <div>
  16. <h4>Copy</h4>
  17.  
  18. <input type="text" ref={(input) => toCopy = input} />
  19. <button onClick={onLocalClick}>Copy me!</button>
  20. </div>
  21. )
  22. }
  23.  
  24. export default ReactCopy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement