import React, {Component} from 'react'; import './MessageAction.scss'; import {Button, FormControl, InputGroup, Modal} from "react-bootstrap"; class MessageAction extends Component { constructor(props) { super(props); this.state = { copyButtonText: "copy" }; this.actionValue = React.createRef(); this.copyActionValue = this.copyActionValue.bind(this); } copyActionValue() { this.actionValue.current.select(); document.execCommand('copy'); this.setState({copyButtonText: "copied!"}); setTimeout(() => this.setState({copyButtonText: "copy"}), 3000); } render() { return ( {this.props.actionName} ); } } export default MessageAction;