import * as React from 'react' import { formatImageSize } from '../../utils/format' interface Props { src: string; defaultImg?: string; width: number; height: number; className?: string; } export class Image extends React.Component { state = { error: false } handleError = () => { this.setState({ error: true }) } public render() { const { src, defaultImg, width, height, className } = this.props const { error } = this.state return ( <> { defaultImg ? ( img ) : ( <> { !error ? ( img ) : ( ) } ) } ) } } export default React.memo(Image)