I tried very hard to find a solution to this problem, but I didn't find anything, could anyone help?
I just want to fetch this data.
typeError: Cannot read property 'map' of undefined -> Error
import styles from '../styles/galery.module.css'
import Image from 'next/image'
import Link from 'next/link'
import photo from '../public/01.png'
export const getStaticProps = async () => {
const response = await fetch('https://api.github.com/orgs/rocketseat');
const data = await response.json();
return {
props: { mods: data }
}
}
const ProjectLines = ({ mods }) => {
return (
<div className={styles.categoryWrapper}>
<h4 className={styles.subTitle}>Escritório</h4>
<div className={styles.lineWrapper}>
<a className={styles.leftArrow}>❮</a>
<div className={styles.line}>
{mods.map(mod => (
<div className={styles.imageBox}>
<Image src={photo} width={400} height={200} layout="responsive" lazy="true" placeholder="blur" />
<div className={styles.linkContent}>
<span className={styles.name}>{mod.login}</span>
<Link href=""><a className={styles.link}>Veja Mais!</a></Link>
</div>
</div>
))}
</div>
<a className={styles.rightArrow}>❯</a>
</div>
</div>
);
}
export default ProjectLines;