【发布时间】:2021-11-05 06:19:26
【问题描述】:
enter code here {
"compdata": [
{
"id": 1,
"title": "FlexBox",
},
{
"id": 2,
"title": "Grid layout",
},
] }
enter code here **file in:-- src-data-data.json**
enter code here export const IndexQuery = graphql`
query IndexQuery {
dataJson {
compdata {
id
example
}
} } `
Blockquote 给我错误 Cannot read properties of undefined (reading 'compdata')
【问题讨论】:
-
您能否更清楚地说明您的问题,很难知道您要达到什么目的
-
通常使用 graphql 并做出反应,您使用的是 graphql 客户端(可能是 Apollo),它应该可以为您处理很多事情。虽然我不太确定你想做什么
-
请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。
标签: javascript reactjs json graphql gatsby