类型错误:无法读取未定义的属性“map”(nextjs)

Gus*_*rio 5 reactjs next.js

我很努力地寻找解决这个问题的方法,但没有找到任何东西,有人可以帮忙吗?

\n

我只想获取这些数据。

\n

typeError:无法读取未定义的属性“map”->错误

\n
import styles from '../styles/galery.module.css'\nimport Image from 'next/image'\nimport Link from 'next/link'\nimport photo from '../public/01.png'\n\nexport const getStaticProps = async () => {\n\n    const response = await fetch('https://api.github.com/orgs/rocketseat');\n    const data = await response.json();\n\n    return {\n        props: { mods: data }\n    }\n}\n\nconst ProjectLines = ({ mods }) => {\n    return (\n        <div className={styles.categoryWrapper}>\n            <h4 className={styles.subTitle}>Escrit\xc3\xb3rio</h4>\n            <div className={styles.lineWrapper}>\n                <a className={styles.leftArrow}>&#10094;</a>\n                <div className={styles.line}>\n                    {mods.map(mod => (\n                        <div className={styles.imageBox}>\n                            <Image src={photo} width={400} height={200} layout="responsive" lazy="true" placeholder="blur" />\n                            <div className={styles.linkContent}>\n                                <span className={styles.name}>{mod.login}</span>\n                                <Link href=""><a className={styles.link}>Veja Mais!</a></Link>\n                            </div>\n                        </div>\n                    ))}\n                </div>\n                <a className={styles.rightArrow}>&#10095;</a>\n            </div>\n        </div>\n    );\n}\nexport default ProjectLines;\n
Run Code Online (Sandbox Code Playgroud)\n

Gus*_*rio 2

我试图在组件存档中使用 getStaticProps,它需要在页面中使用...谢谢大家。

NextJS 文档