TypeError:无法读取未定义的属性“ title”(盖茨比错误)

时间:2019-10-22 17:10:28

标签: reactjs gatsby

我遇到了昨天没收到的错误,我无法弄清楚问题出在哪里。

我尝试更新npm和gatsby-cli,Ive清除了所有缓存。

Project.js文件:

import React from 'react'
import Image from 'gatsby-image'
import styles from '../../css/tour.module.css'
import {FaMap} from 'react-icons/fa'
import AniLink from 'gatsby-plugin-transition-link/AniLink'

const Project = ({project}) => {
    const {title,description,updated,slug,images} = project
    console.log(images);
    return <article>this is a single project</article>
}

export default Project

我正在尝试在控制台中查看图像数组,但是对于尝试分配给项目变量的所有内容,我都会收到此错误

Project.js:1 Uncaught TypeError: Cannot read property 'title' of undefined
    at Project (Project.js:1)
    at renderWithHooks (react-dom.development.js:16319)
    at mountIndeterminateComponent (react-dom.development.js:18734)
    at beginWork$1 (react-dom.development.js:20083)
    at HTMLUnknownElement.callCallback (react-dom.development.js:363)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:412)
    at invokeGuardedCallback (react-dom.development.js:467)
    at beginWork$$1 (react-dom.development.js:25729)
    at performUnitOfWork (react-dom.development.js:24637)
    at workLoopSync (react-dom.development.js:24613)
    at performSyncWorkOnRoot (react-dom.development.js:24181)
    at scheduleUpdateOnFiber (react-dom.development.js:23589)
    at scheduleRootUpdate (react-dom.development.js:26944)
    at updateContainerAtExpirationTime (react-dom.development.js:26972)
    at updateContainer (react-dom.development.js:27074)
    at react-dom.development.js:27662
    at unbatchedUpdates (react-dom.development.js:24374)
    at legacyRenderSubtreeIntoContainer (react-dom.development.js:27661)
    at render (react-dom.development.js:27804)
    at app.js:40

此错误仅在chrome控制台中显示,在我的VS终端中构建成功。

0 个答案:

没有答案