我有一个包含 png 格式图像的响应,但我无法在 React 中显示它,因为它不是 响应的 url 图片
有谁知道如何将此 png 转换为 URL,以便将其插入到我的 img 标签的 src 中?
我正在尝试创建一个渲染道具包装组件。它正在工作,但我收到类型错误。这也是我指向代码沙箱的链接。链接到沙箱
寻找react/typescript大师寻求帮助
type Props = {
children: JSX.Element;
};
const ControlledWrapper: FC<Props> = ({ children }) => {
const state: { hello: string } = { hello: 'hello' };
return children(state);
};
export default function App() {
return (
<ControlledWrapper>
{({ hello }) => <div>{hello}</div>}
</ControlledWrapper>
);
}
Run Code Online (Sandbox Code Playgroud)