1
我已经插入图像到数据库,并且我正在从数据库接收图像到服务器和reactjs但在我的反应,我收到它有二进制数据。 但我如何将二进制数据转换为图像中的反应。如何将二进制数据转换为图像reactjs
class Pre extends React.Component{
constructor(props){
super(props);
this.state={
post:[]
};
}
componentDidMount(){
let self = this;
axios.get('http://localhost:8080/images')
.then(function(data) {
//console.log(data);
self.setState({post:data.data});
});
}
render(){
console.log(this.state.post);
return(
<div className="w3-container">
<p className="addboard"> <Link className="linkpre" to="/createstudent I">
<button className="addbutton" type="button"><h1>+</h1></button></Link></p>
{this.state.post}
)}
)}
</div>
);
}
}
export default Pre;