在Next.js中使用 new Image() 会报错未定义
const image = useRef<HTMLImageElement>(new Image());
解决
const image = useRef(null);
<img
ref={image}
style={{
opacity: 0,
}}
/>
微信扫一扫
在Next.js中使用 new Image() 会报错未定义
const image = useRef<HTMLImageElement>(new Image());
解决
const image = useRef(null);
<img
ref={image}
style={{
opacity: 0,
}}
/>
相关推荐