{"record":{"id":"e6c4af9f902bd66e","repo":"gatsbyjs/gatsby","slug":"the-staticquery-component-is-deprecated-and-wi","errorCode":null,"errorMessage":"The <StaticQuery /> component is deprecated and will be removed in Gatsby v6. Use useStaticQuery instead. Refer to the migration guide for more information: https://gatsby.dev/migrating-4-to-5/#staticquery--is-deprecated","messagePattern":"The <StaticQuery /> component is deprecated and will be removed in Gatsby v6\\. Use useStaticQuery instead\\. Refer to the migration guide for more information: https://gatsby\\.dev/migrating-4-to-5/#staticquery--is-deprecated","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/cache-dir/static-query.js","lineNumber":27,"sourceCode":"    ? data.data\n    : staticQueryData[query] && staticQueryData[query].data\n\n  return (\n    <React.Fragment>\n      {finalData && render(finalData)}\n      {!finalData && <div>Loading (StaticQuery)</div>}\n    </React.Fragment>\n  )\n}\n\nlet warnedAboutStaticQuery = false\n\n// TODO(v6): Remove completely\nconst StaticQuery = props => {\n  const { data, query, render, children } = props\n\n  if (process.env.NODE_ENV === `development` && !warnedAboutStaticQuery) {\n    console.warn(\n      `The <StaticQuery /> component is deprecated and will be removed in Gatsby v6. Use useStaticQuery instead. Refer to the migration guide for more information: https://gatsby.dev/migrating-4-to-5/#staticquery--is-deprecated`\n    )\n    warnedAboutStaticQuery = true\n  }\n\n  return (\n    <StaticQueryContext.Consumer>\n      {staticQueryData => (\n        <StaticQueryDataRenderer\n          data={data}\n          query={query}\n          render={render || children}\n          staticQueryData={staticQueryData}\n        />\n      )}\n    </StaticQueryContext.Consumer>\n  )\n}","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby/cache-dir/static-query.js#L9-L45","documentation":"Error \"The <StaticQuery /> component is deprecated and will be removed in Gatsby v6. Use useStaticQuery instead. Refer to the migration guide for more information: https://gatsby.dev/migrating-4-to-5/#staticquery--is-deprecated\" thrown in gatsbyjs/gatsby.","triggerScenarios":"Thrown at packages/gatsby/cache-dir/static-query.js:27 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Replace <StaticQuery query={...} render={...}> with const data = useStaticQuery(graphql`...`) in a component","For class components or HOCs, wrap a small function component that calls useStaticQuery","Follow https://gatsby.dev/migrating-4-to-5/#staticquery--is-deprecated","useStaticQuery requires the query to be exported/moved to a page or layout component when called outside the data tree"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e85d62f1779e353eaac1753211629a26d123e26c","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}