在Next.js中使用 new Image() 会报错未定义
const image = useRef<HTMLImageElement>(new Image());
解决
const image = useRef(null);
<img
ref={image}
style={{
opacity: 0,
}}
/>
Next.js服务端new Image() 未定义解决 react
阅读 152
2023-02-14
在Next.js中使用 new Image() 会报错未定义
const image = useRef<HTMLImageElement>(new Image());
解决
const image = useRef(null);
<img
ref={image}
style={{
opacity: 0,
}}
/>
相关推荐
精彩评论(0)