import React from 'react' import ReactDOM from 'react-dom' import Avatar from 'react-avatar-edit' class App extends React.Component { constructor(props) { super(props) const src = './example/einshtein.jpg' this.state = { preview: null, src } this.onCrop = this.onCrop.bind(this) this.onClose = this.onClose.bind(this) this.onBeforeFileLoad = this.onBeforeFileLoad.bind(this) } onClose() { this.setState({preview: null}) } onCrop(preview) { this.setState({preview}) } onBeforeFileLoad(elem) { if(elem.target.files[0].size > 71680){ alert("File is too big!"); elem.target.value = ""; }; } } const Avatar = () => { return (
Preview
) } export default Avatar