我正在编写代码以将图像作为API响应作为字节数组返回到我的浏览器。如果直接调用api,则可以看到图像,但不能使用react渲染它。下面是我获取字节数组的代码段
ScreenShareService.subscribe("SRJ1001").then(data => { // This fetches the byte array
console.log('ComponentDidMount '+this.state.image) // this is printing the byte array
this.setState({image: data.data})
})
.catch(
(err)=>{
console.log(err)
}
)
render(){
return(
<>
<div>
{this.state.image}
</div>
</>
);
}
请协助