【发布时间】:2019-04-12 05:59:36
【问题描述】:
[
{
"acronym": "VMF",
"defaultValue": "Video & Audio Management Function",
"description": "This is defined as the Video and/or Audio Management functionality that can be performed on a Digital Item. The Video & Audio Management functions that will exist on the HDEM platform are as follows:\n· CLIP\n· REDACT\n· THUMBNAIL\n· STILL IMAGE\n· AMALGAMATION",
"id": "5caddba33a87fd7fa5ee601c",
"name": "Video & Audio Management Function",
"updatedBy": " ",
"updatedDate": "2019-04-07T00:00:00Z"
},
{
"acronym": "",
"defaultValue": "Url Downloadable",
"description": "Admin configurable header to denote whether the Digital Item/Data within a URL either via Prosecution Readiness or Assign Digital Data can be downloaded.",
"id": "5caddba33a87fd7fa5ee6098",
"name": "Url Downloadable",
"updatedBy": " ",
"updatedDate": "2019-04-07T00:00:00Z"
}]
我有这个示例 json,我想要与一个 id 相关的数据,我应该如何在反应中得到它
InfoDescription:_.filter(response, (i) => { return i.id === "passing id here"})
使用这个但不工作
【问题讨论】:
-
为什么不 dataToFilter.filter(item => item.id === "passing id here?")
-
请分享来自控制台的错误,或者任何关于什么不工作的细节?
-
一切正常in the fiddle。
-
我也执行了这段代码 sn-p 并且运行良好。
标签: javascript reactjs lodash