【发布时间】:2022-10-20 18:22:34
【问题描述】:
我正在使用 next.js,我希望在点击我的一张图片时看到像 这样的画廊收藏,但没有发生。实际上,这就像我刚刚使用了一个普通组件一样,因为当我单击其中一张图像时,实际上什么都没有发生。请帮忙。
// this is my app component
import SimpleReactLightbox from 'simple-react-lightbox'
const MyApp = ()=>{
return(
<SimpleReactLightbox>
<Component {...pageProps} />
</SimpleReactLightbox>
)
}
// this is my collection
import { CollectionStyledTypography } from './styles/collectionStyledComponents'
import { SRLWrapper } from 'simple-react-lightbox'
import Image from 'next/image'
const Collection = ({ imagesList = [] }) => {
return (
<SRLWrapper>
<div style={{ margin: '50px' }}>
{imagesList.map((image, index) => (
<CollectionStyledTypography component="div" key={index}>
<Image src={image.src} alt={image.alt} layout="fill" />
</CollectionStyledTypography>
))}
</div>
</SRLWrapper>
)
}
export default Collection
【问题讨论】:
标签: next.js