Reactjs 使用Clarifai的API和react的useState和useEffect时,400错误的请求API调用

Reactjs 使用Clarifai的API和react的useState和useEffect时,400错误的请求API调用,reactjs,callback,use-effect,use-state,clarifai,Reactjs,Callback,Use Effect,Use State,Clarifai,尝试通过我安装的拖放包react dropzone,使用clarifai的Api构建一个识别图像中人脸和对象的应用程序。当我使用静态图像时,我从Clarifai得到一个没有任何错误的响应,但是当我试图从我的状态加载它时,我总是收到400个错误的请求 我认为这个错误可能与useState的工作方式有关 请问有谁能帮忙吗 请参阅下面的代码 从“React”导入React,{useState,useffect}; 从“Clarifai”进口Clarifai; 从“react Dropzone”导入Dr

尝试通过我安装的拖放包react dropzone,使用clarifai的Api构建一个识别图像中人脸和对象的应用程序。当我使用静态图像时,我从Clarifai得到一个没有任何错误的响应,但是当我试图从我的状态加载它时,我总是收到400个错误的请求

我认为这个错误可能与useState的工作方式有关

请问有谁能帮忙吗

请参阅下面的代码

从“React”导入React,{useState,useffect}; 从“Clarifai”进口Clarifai; 从“react Dropzone”导入Dropzone; 从“./components/Header/Header.component.jsx”导入标题; 从“./components/Modal/Modal.component”导入模态; 从“./components/Box/Box.component”导入框; 导入“/App.css”; const app=新的Clarifai.app{ apiKey:“编辑” }; 常量应用==>{ const[fileProperties,setFileProperties]=useState[]; 常量[isModalOpen,setModal]=useStatefalse; const handleDrop=acceptedFiles=>{ setFilePropertiesacceptedFiles.mapfile=>URL.createObjectURLfile; 切换模式 } useEffect=>{ iffileProperties.length>0{ console.logfileProperties; app.models.predictClarifai.FACE\u DETECT\u MODEL,fileProperties.then 函数响应{ console.logresponse; }, 函数器{ console.log“出现错误”,err; } ; } },[fileProperties]; const toggleModal==>{ setModal!isModalOpen; } 回来 {isModalOpen&& } {{getRootProps,getInputProps,isDragActive,isDragAccept,isDragReject}=>{ //附加CSS取决于拖动状态 const additionalClass=isDragAccept?接受:isDragReject?拒绝:; 回来 这个智能盒可以检测图像中的人脸和物体,如太阳镜和帽子
{isDragActive?URL.createObjectURL返回DOMString,您需要发送base64字符串或Clarifai可以访问的URL。

在console.loging之后,我看到它生成了这个[blob:。那么我如何将它转换为base64?