Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Graphql …GatsbySanityImageFluid-无法读取属性';流体';空的_Graphql_Gatsby_Sanity - Fatal编程技术网

Graphql …GatsbySanityImageFluid-无法读取属性';流体';空的

Graphql …GatsbySanityImageFluid-无法读取属性';流体';空的,graphql,gatsby,sanity,Graphql,Gatsby,Sanity,我和理智和盖茨比一起工作 我正在尝试映射一组图像,以便在图像库中显示它们。我的GraphQL查询正在工作,我能够显示单个图像,但收到错误:TypeError:当我尝试映射数组时,无法读取null的属性'fluid' 任何方向都非常感谢 我的问题是: { 卫生室{ 图像{ 资产{ 流质{ …GatsbySanityImageFluid } } } } } 这项工作: const images=data.sanityGallery.images 这并不是: const images=data.s

我和理智和盖茨比一起工作

我正在尝试映射一组图像,以便在图像库中显示它们。我的GraphQL查询正在工作,我能够显示单个图像,但收到错误:
TypeError:当我尝试映射数组时,无法读取null的属性'fluid'

任何方向都非常感谢

我的问题是:

{
卫生室{
图像{
资产{
流质{
…GatsbySanityImageFluid
}
}
}
}
}
这项工作:

const images=data.sanityGallery.images
这并不是:

const images=data.sanityGallery.images
{images.map((图像,索引)=>{
console.log(image.asset.fluid);//尝试以下方法:

const images = data.sanityGallery.images

<div className="img-container">
  {images.map((image, index) => {
    console.log(image.asset); // 
    return (
      <div className="box">
        {image.asset && <Img className="grow" fluid={image.asset.srcSet} key={index} />}
      </div>
    )
  })}
</div>
const images=data.sanityGallery.images
{images.map((图像,索引)=>{
console.log(image.asset);//
返回(
{image.asset&&}
)
})}

现在它给了我错误:
TypeError:无法读取null的属性'srcSet'
尝试:
{image.asset&&}
代码不会中断,但我想知道它是否仍然显示图像。可能有一个损坏的图像中断了代码,而其余的(您提供的输出)正常工作