1

My blog.js component :

import {useStaticQuery, graphql} from "gatsby"


const blog = () => {
    const {site} = useStaticQuery(
        graphql`
      query {
        site {
          siteMetadata {
            title
          }
        }
      }
    `
    )
    return site.siteMetadata
}

export default blog

Gatsby docs : https://www.gatsbyjs.org/docs/use-static-query/

I've tried to fixed this issue !!

have any solution ??

Thanks

ksav
  • 20,015
  • 6
  • 46
  • 66

1 Answers1

9

Capitalise the name of your component:

import {useStaticQuery, graphql} from "gatsby"


const Blog = () => {
  const {site} = useStaticQuery(
    graphql`
      query {
        site {
          siteMetadata {
            title
          }
        }
      }
    `
  )
  return site.siteMetadata
}

export default Blog

User-Defined Components Must Be Capitalized

We recommend naming components with a capital letter. If you do have a component that starts with a lowercase letter, assign it to a capitalized variable before using it in JSX.

ksav
  • 20,015
  • 6
  • 46
  • 66
  • Not working !! It's working , when i use `StaticQuery` . https://www.gatsbyjs.org/docs/static-query/ –  May 11 '20 at 05:43
  • Are you able to provide more information as to exactly what's not working? – ksav May 11 '20 at 05:44