flyfloor / react-image-cropper

react image crop
https://braavos.me/react-image-cropper/
MIT License
174 stars 56 forks source link

Got error: Element type is invalid #34

Closed LeoEatle closed 6 years ago

LeoEatle commented 6 years ago

I use it like this:

<Cropper
    ref={ ref => { this.cropper = ref }}
    src={this.state.tempPic}
    width={540}
    height={540}
    ratio={1 / 1}
    fixedRatio={true}
    onChange={this.CropperChange} >
</Cropper>

But I get this error:

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

Is there anything wrong with my usage or a bug?

LeoEatle commented 6 years ago

Get the answer. This component is not exported as default. So use import {Cropper} from 'react-image-cropper' then everything is ok. Closed. ;)