Download wp-calypso/client/components/forms/clipboard-button/docs/example.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 545 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/forms/clipboard-button/docs/example.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/components/forms/clipboard-button/docs/example.jsx
-
curl -L -o example.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/forms/clipboard-button/docs/example.jsx
545 Bytes
| import { PureComponent } from 'react'; | |
| import ClipboardButton from '../'; | |
| export default class extends PureComponent { | |
| static displayName = 'ClipboardButtons'; | |
| state = { | |
| isCopied: false, | |
| }; | |
| onCopy = () => { | |
| this.setState( { | |
| isCopied: true, | |
| } ); | |
| }; | |
| render() { | |
| return ( | |
| <div> | |
| <ClipboardButton | |
| onCopy={ this.onCopy } | |
| text="This text was copied via ClipboardButton" | |
| style={ { float: 'none' } } | |
| > | |
| { this.state.isCopied ? 'Copied!' : 'Copy to clipboard' } | |
| </ClipboardButton> | |
| </div> | |
| ); | |
| } | |
| } | |