首页 > 解决方案 > 如何在reactjs中将数据二进制转换为图像?

问题描述

标签: javascriptreactjsimagereact-nativeaxios

解决方案


You can do this:

<img src={`data:image/*;base64,${props.generated}`} alt="generated motif" />

But you must ensure response from your API is something that can be decoded.

See PHP's base64_encode() and this Stackoverflow answer.


推荐阅读