import React, { Component } from 'react'; import domtoimage from 'dom-to-image'; import { Form, Input } from 'semantic-ui-react' import './App.css'; class App extends Component { constructor(props) { super(props); this.sticker = React.createRef(); this.appBody = React.createRef(); this.state = { messageText: 'What should I say?', messageTime: '12:34 PM', canvas: [] }; } componentDidMount() { domtoimage.toPng(this.sticker.current).then(dataUrl => { let img = new Image(); img.src = dataUrl; this.appBody.current.appendChild(img); }); } render() { return (
{this.state.messageText}
{this.state.messageTime}
); } } export default App;