Rendering different output, depending on whether it is SSR or CSR, can lead to hard-to-debug rehydration problems in Gatsby.
Examples of incorrect code for this rule:
if ('undefined' === typeof window) {}
if ('undefined' == typeof window) {}
if (typeof window !== 'undefined') {}
if (typeof window != 'undefined') {}
if (typeof window != "undefined") {}
if (typeof window != `undefined`) {}
if (typeof window !== `undefined`) {}
if (typeof globalThis !== `undefined`) {}
if (typeof self !== `undefined`) {}
const a = typeof window !== 'undefined' ? 1 : 2;
const b = (typeof window !== 'undefined' ? 1 : 2);
(typeof window !== 'undefined' && window.innerWidth <= 1024);
If you've ensured that your check does not produce a different DOM structure for SSR and CSR, and that there is no other way to do it.