How to use the gatsby.useStaticQuery function in gatsby

To help you get started, we’ve selected a few gatsby examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github prisma / women-world-wide / src / components / Map.js View on Github external
const Map = ({ setCurrentCity }) => {

  const data = useStaticQuery(citiesQuery)
  const cities = data.allCitiesJson.edges

  useEffect(() => { new Rellax('.rellax') }, [])

  const handleDotClick = city => {
    window.scrollTo({ top: 850, behavior: 'smooth' })
    setCurrentCity({ label: city.name, value: city.slug })
  }

  return (
    
      <title data-rellax-speed="-5">
        Find incredible, local groups for women in tech
      </title>
github gatsbyjs / gatsby / packages / gatsby-theme-blog / src / components / bio.js View on Github external
const Bio = () =&gt; {
  const data = useStaticQuery(bioQuery)
  const {
    site: {
      siteMetadata: { author },
    },
    avatar,
  } = data

  return (
    
      {avatar ? (
github san-diego-tech-hub / sdth-site / src / components / about / index.js View on Github external
function About() {
  const {
    markdownRemark: { frontmatter }
  } = useStaticQuery(aboutQuery)

  return (
    <main>
      
        <h2>{frontmatter.whatisSDTHTitle}</h2>
        
          {frontmatter.whatisSDTHDescription}
        
      

      
        <h2>{frontmatter.mainTitle}</h2>

        <p>
          </p></main>
github tinacms / tina-starter-grande / src / components / pageLayout.js View on Github external
export const PageLayout = ({ page, children }) => {
  const data = useStaticQuery(graphql`
    query PageLayoutQuery {
      nav: settingsJson(
        fileRelativePath: { eq: "/content/settings/menu.json" }
      ) {
        ...nav

        rawJson
        fileRelativePath
      }
      theme: settingsJson(
        fileRelativePath: { eq: "/content/settings/theme.json" }
      ) {
        ...globalTheme

        rawJson
        fileRelativePath
github LaunchAcademy / codecabulary / src / components / header.js View on Github external
const Header = (props) =&gt; {
  const data = useStaticQuery(graphql`
    query {
      file(relativePath: { eq: "launch-logo.png" }) {
        childImageSharp {
          # Specify the image processing specifications right in the query.
          # Makes it trivial to update as your page's design changes.
          fixed(width: 60, height: 60) {
            src,
            width,
            height
          }
        }
      }
    }
  `)
  return (
  <div></div>
github akzhy / gatsby-starter-elemental / src / components / seo.js View on Github external
function SEO({ description, lang, meta, title, image }) {
    const { site } = useStaticQuery(
        graphql`
            query {
                site {
                    siteMetadata {
                        title
                        description
                        author
                        logo
                    }
                }
            }
        `
    );

    const metaDescription = description || site.siteMetadata.description;
    const ogImage = image || site.siteMetadata.logo;
github apollographql / gatsby-theme-apollo / packages / gatsby-theme-apollo-docs / src / components / page-layout.js View on Github external
export default function PageLayout(props) {
  const data = useStaticQuery(
    graphql`
      {
        site {
          siteMetadata {
            title
            siteName
            subtitle
          }
        }
      }
    `
  );

  const {
    sidebarRef,
    openSidebar,
github Abhith / abhith.net / src / components / SEO / SEO.js View on Github external
function SEO({
  description,
  lang,
  meta,
  title,
  image,
  isBlogPost,
  slug,
  dateModified,
  datePublished
}) {
  const { site, posts, stories, videos, services } = useStaticQuery(
    graphql`
      query {
        site {
          siteMetadata {
            title
            description
            author {
              name
            }
            image
            siteUrl
            social {
              twitter
            }
          }
        }
github ChilliCream / hotchocolate / website / src / components / structure / header.tsx View on Github external
export const Header: FunctionComponent = () =&gt; {
  const [topNavOpen, setTopNavOpen] = useState(false);
  const data = useStaticQuery(graphql`
    query getHeaderData {
      site {
        siteMetadata {
          siteUrl
          topnav {
            name
            link
          }
          tools {
            github
            slack
            twitter
          }
        }
      }
    }