首页 > 解决方案 > 获取 TypeError:无法读取未定义的属性“句柄”,但无法弄清楚原因

问题描述

我目前正在关注 FCC 频道上的 youtube 应用程序课程。一切都很好,我即将完成它,但是自从在应用程序的客户端工作中途以来,我遇到了一个问题。我不断得到TypeError: Cannot read property 'handle' of undefined它,它在以下代码中突出显示“凭据”:

render () {
  const {
    classes,
    user: {
      credentials: { handle, createdAt, imageUrl, bio, website, location },
      loading,
      authenticated,
    },
  } = this.props;

我不知道为什么,我尝试了其他用户找到的几种解决方案,但无济于事。这是我在 github “https://github.com/HelmutKaltsburg/socialize-client”上的工作的链接,以下 js 文件中有错误“https://github.com/HelmutKaltsburg/socialize-client/blob/主/src/components/profile/Profile.js"

编辑:我检查了我的 redux 状态,在用户登录后“已验证”变为真,但“凭据”没有,并且在错误消息显示凭据全部加载后,因此我留在错误消息中并有手动转到 localhost:3000/home

标签: javascriptreactjstypeerror

解决方案


推荐阅读