Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react'
- const ReactCopy = () => {
- let toCopy
- const onLocalClick = e => {
- e.preventDefault()
- toCopy.select()
- let onClipboard = toCopy.value
- onClipboard = document.execCommand('copy')
- }
- return (
- <div>
- <h4>Copy</h4>
- <input type="text" ref={(input) => toCopy = input} />
- <button onClick={onLocalClick}>Copy me!</button>
- </div>
- )
- }
- export default ReactCopy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement