ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# react-copy-to-clipboard react 复制粘贴 ``` npm install --save react react-copy-to-clipboard import React from'react'; import ReactDOM from'react-dom'; import {CopyToClipboard} from'react-copy-to-clipboard'; class App extends React.Component {   state = { value: '', copied: false,   };   render() { return (         <input value\={this.state.value}           onChange\={({target: {value}}) => this.setState({value, copied: false})} />           <CopyToClipboard text\={this.state.value}           onCopy\={() => this.setState({copied: true})}>           Copy to clipboard with span                    <CopyToClipboard text\={this.state.value}           onCopy\={() => this.setState({copied: true})}>           Copy to clipboard with button                    {this.state.copied ? Copied. : null}            );   } } const appRoot = document.createElement('div'); document.body.appendChild(appRoot); ReactDOM.render(, appRoot); ```