Using wrapPageElement in gatsby-browser.js and gatsby-ssr.js is causing header and footer elements to render twice.
gatsby-browser.js
import React from 'react';
import PageLayout from './src/components/layout/PageLayout';
export const wrapPageElement = ({ element, props }) => {
// Wraps every page in a component
return <PageLayout {...props}>{element}</PageLayout>;
};
gatsby-ssr.js
import React from 'react';
import PageLayout from './src/components/layout/PageLayout';
export const wrapPageElement = ({ element, props }) => {
// Wraps every page in a component
return <PageLayout {...props}>{element}</PageLayout>;
};
PageLayout.tsx
const PageLayout: FC =() =>{
return (
<PageWrapper>
<Header/>
<Footer/>
</PageWrapper>
);
};
I also have errors in these files on the return line but can't see what is causing the error
JSHint: Expected an assignment or function call and instead saw an expression.(W030)
Is there any alternatives or known causes of this?