import React from 'react' import domtoimage from 'dom-to-image' const padding = '50px 50px' class CodeImage extends React.Component { constructor () { super() this.save = this.save.bind(this) } save () { // save domtoimage.toJpeg(this.container) .then((dataUrl) => { const link = document.createElement('a') link.download = 'my-image-name.jpeg' link.href = dataUrl link.click() }) } render () { return (
{this.props.children}