【问题标题】:TypeError: Cannot read properties of undefined (reading 'match'):TypeError:无法读取未定义的属性(读取“匹配”):
【发布时间】:2022-01-05 14:27:21
【问题描述】:
Product.find((x)=>x._id===props.params.match.id);

products: [
      {
        _id: '1',
        name: 'Nike Slim Shirt',
        category: 'Shirts',
        image: '/images/p1.jpg',
        price: 120,
        countInStock: 10,
        brand: 'Nike',
        rating: 4.5,
        numReviews: 10,
        description: 'high quality product',
      },

【问题讨论】:

标签: javascript reactjs components typeerror react-props


【解决方案1】:

因为 Params 属性未定义。

【讨论】:

  • 我该如何定义它?
  • 为了表达意见,你应该提供更多关于你的代码库的细节
猜你喜欢
  • 2022-01-01
  • 1970-01-01
  • 2022-07-06
  • 2022-07-12
  • 2022-01-15
  • 1970-01-01
  • 2021-04-04
  • 1970-01-01
  • 2021-11-26
相关资源
最近更新 更多