-
Notifications
You must be signed in to change notification settings - Fork 3
/
gatsby-ssr.js
28 lines (28 loc) · 1.03 KB
/
gatsby-ssr.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// /* eslint-disable react/no-danger */
//
// const React = require('react');
// const { renderToString } = require('react-dom/server');
// const { JssProvider } = require('react-jss');
// const getPageContext = require('./src/components/mui/getPageContext');
//
// function replaceRenderer({ bodyComponent, replaceBodyHTMLString, setHeadComponents }) {
// // Get the context of the page to collected side effects.
// // Ternary to support Gatsby@1 and Gatsby@2 at the same time.
// const muiPageContext = getPageContext.default ? getPageContext.default() : getPageContext();
//
// const bodyHTML = renderToString(
// <JssProvider registry={muiPageContext.sheetsRegistry}>{bodyComponent}</JssProvider>,
// );
//
// replaceBodyHTMLString(bodyHTML);
// setHeadComponents([
// <style
// type="text/css"
// id="server-side-jss"
// key="server-side-jss"
// dangerouslySetInnerHTML={{ __html: muiPageContext.sheetsRegistry.toString() }}
// />,
// ]);
// }
//
// exports.replaceRenderer = replaceRenderer;