1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-22 17:23:22 +01:00
portfolio/gatsby-ssr.js
2019-04-28 22:30:20 +02:00

14 lines
532 B
JavaScript

import React from 'react'
import { renderToString } from 'react-dom/server'
import AppProvider from './src/store/AppProvider'
import wrapPageElementWithLayout from './src/helpers/wrapPageElement'
export const replaceRenderer = ({ bodyComponent, replaceBodyHTMLString }) => {
// React Context in SSR/build
const ConnectedBody = () => <AppProvider>{bodyComponent}</AppProvider>
replaceBodyHTMLString(renderToString(<ConnectedBody />))
}
// Layout with Page Transitions
export const wrapPageElement = wrapPageElementWithLayout