Anybody having a problem with "useStaticQuery" Hook on Gatsby

I have no clue why it’s not working for me, I’m following the Gatsby tutorials

Hello there,

If you are looking for help to debug what you are doing, you are going to need to provide a lot more information about what you have, what you are trying to do, and what you are experiencing.

Ideally, including a link to a Replit, Glitch, or CodeSandbox implementation. Otherwise, a link to your code hosted on something like GitHub.
As a minimum, pasting the relevant code you have, and some context as to what you are trying to do.

Also, you have mentioned the Gatsby tutorials, but which section?

The more information you give us, the more likely we will be able to help.

import React from "react"
import { css } from "@emotion/react"
import { useStaticQuery, Link, graphql } from "gatsby"
import { rhythm } from "../utils/typography"
export default function Layout({ children }) {
  const data = useStaticQuery(
    graphql`
      query {
        site {
          siteMetadata {
            title
          }
        }
      }
    `
  )
  return (
    <div
      css={css`
        margin: 0 auto;
        max-width: 700px;
        padding: ${rhythm(2)};
        padding-top: ${rhythm(1.5)};
      `}
    >
      <Link to={`/`}>
        <h3
          css={css`
            margin-bottom: ${rhythm(2)};
            display: inline-block;
            font-style: normal;
          `}
        >
          {data.site.siteMetadata.title}
        </h3>
      </Link>
      <Link
        to={`/about/`}
        css={css`
          float: right;
        `}
      >
        About
      </Link>
      {children}
    </div>
  )
}

When i try to run it on developer server I get “The result of this StaticQuery could not be fetched”,

All I want to do is discard any access errors disrupting the data fetch from the query,I don’t get any syntax errors.

Here’s the gatsby tutorial I’m following

https://www.gatsbyjs.com/docs/tutorial/part-four/

Are there any more logs you can share? Have you looked to confirm that the data is there, by going to the /___graphql address?

Nevermind, i missed my delivery deadline,I’m reinstalling Ubuntu,Npm,nvm , we can close this thread now.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.