【发布时间】:2021-02-13 18:20:12
【问题描述】:
Next.js 在 v10 中引入了一个新的 Image 组件,它应该是 <img> 标记的替代品。
我在尝试查看将 next/image 导入 Storybook 的组件时出错:
TypeError: imageData is undefined
我一直在尝试覆盖 preview.js 中的图像对象(我用于 next/router 的技术,如文档中的 here 所述)但我得到了同样的错误:
// .storybook/preview.js
import Image from 'next/image';
Image = ({ src }) => <img src={src} />;
知道如何覆盖 Storybook 中 next/image 包的行为吗?
【问题讨论】:
标签: javascript reactjs next.js storybook nextjs-image