import * as React from "react"; export class DynamicIcon extends React.Component { state = { clicked: false, }; _handleClick = (e) => { if (this.props.onClick) { this.props.onClick(e); } this.setState({ clicked: true }); setTimeout(() => this.setState({ clicked: false }), this.props.timeout || 1000); }; render() { return (
{this.state.clicked ? this.props.successState : this.props.children}
); } }