【发布时间】:2021-03-12 12:11:28
【问题描述】:
在使用 Gatsby 的 gatsby-source-filesystem 插件时,有没有办法动态进行 graphQL 查询?
例如,我希望完成以下工作:
return (
<StaticQuery
query={graphql`
query chartQuery {
all${fileKey}Json { <------- Is this a thing?
nodes {
name
data
color
}
}
}
`}
理想情况下,我想将文件名作为道具传递。
【问题讨论】: