Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

92
Vistas
Gatsby's StaticQuery renders nothing

I'm able to log the data in the console but StaticQuery renders absolutely nothing (not even the "Hello").

import React from "react";
import { graphql, StaticQuery } from "gatsby";

export default function Header() {
  return (
      <StaticQuery
        query={
          graphql`
          {
            allStrapiPage {
              nodes {
                id
                publishedAt
                slug: Slug
                title: Titulo
                body: Corpo {
                  Titulo
                  Texto {
                    data {
                      text: Texto
                    }
                  }
                }
              }
            }
          }
        `
        }
        render={data => {
          <header>
            <h1>Hello</h1>
            <h1>{console.log(data)}</h1>
          </header>
        }}
      />
  )
}

Here's my index.jsx:

import * as React from "react"
import Header from "../components/Header"

const IndexPage = () => {
  return (
    <main>
      <Header />
    </main>
  )
}

export default IndexPage

I've already tried removing the node_modules and installing it again with different package managers.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You need to return the statement inside:

render={data => {
  return <header>
    <h1>Hello</h1>
    <h1>{console.log(data)}</h1>
  </header>
}}

Or using the implicit return:

render={data => (
  <header>
    <h1>Hello</h1>
    <h1>{console.log(data)}</h1>
  </header>
)}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda