The gatsby-ssr.js API file
gatsby-ssr.js lets you alter the content of static HTML files as they are being Server-Side Rendered (SSR) by Gatsby and Node.js. To use the Gatsby SSR APIs, create a file called
gatsby-ssr.js in the root of your site. Export any of the APIs you wish to use in this file.
wrapRootElement exist in both the SSR and browser APIs. If you use one of them, consider if you should implement it in both