File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
reference/built-in-components Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -92,3 +92,19 @@ Static queries thus have these limitations:
9292
9393- ` useStaticQuery ` does not accept variables (hence the name "static"), but can be used in _ any_ component, including pages
9494- Because of how queries currently work in Gatsby, Gatsby supports only a single instance of ` useStaticQuery ` in a file
95+
96+ ## Other limitations
97+
98+ ### Must be in ` src ` directory
99+
100+ ` useStaticQuery ` must be used in files that are nested below your site's top-level ` src ` directory. For example:
101+
102+ ` useStaticQuery ` works in these files:
103+
104+ - ` <SITE_ROOT>/src/my-page.js `
105+ - ` <SITE_ROOT>/src/components/my-component.js `
106+
107+ ` useStaticQuery ` ** does not** work in these files:
108+
109+ - ` <SITE_ROOT>/other-components/other-component.js `
110+ - ` <SITE_ROOT>/other-library/other-component.js `
Original file line number Diff line number Diff line change @@ -99,6 +99,20 @@ export const query = graphql`
9999
100100## Restrictions on using ` <Slice> ` placeholder
101101
102+ ### Must be in ` src ` directory
103+
104+ Slice placeholders must be used in files that are nested below your site's top-level ` src ` directory. For example:
105+
106+ Slice placeholders work in these files:
107+
108+ - ` <SITE_ROOT>/src/my-page.js `
109+ - ` <SITE_ROOT>/src/components/my-component.js `
110+
111+ Slice placeholders ** do not** work in these files:
112+
113+ - ` <SITE_ROOT>/other-components/other-component.js `
114+ - ` <SITE_ROOT>/other-library/other-component.js `
115+
102116### Nested Slices
103117
104118Gatsby does not support nested Slice placeholders. This means if you have a high level ` <Layout> ` component as a slice component, other Slice placeholders cannot exist within that ` <Layout> ` component anywhere in the tree.
You can’t perform that action at this time.
0 commit comments