背景:想在表单中使用antd4提供的Imgcrop上传并裁剪图片,使用后发现会报找不到refs,但是又不能改Imgcrop的源码,请问各位大佬有解决方法吗?
代码:
{getFieldDecorator('logo')(
<ImgCrop>
<Upload
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
listType="picture-card"
>
上传
</Upload>
</ImgCrop>
)}
报错信息:
Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…