1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-11-15 01:25:25 +01:00
portfolio/gatsby-ssr.js

14 lines
532 B
JavaScript
Raw Normal View History

2018-09-16 21:33:42 +02:00
import React from 'react'
import { renderToString } from 'react-dom/server'
2019-04-28 22:30:20 +02:00
import AppProvider from './src/store/AppProvider'
import wrapPageElementWithLayout from './src/helpers/wrapPageElement'
2018-09-14 18:27:49 +02:00
2018-09-16 21:33:42 +02:00
export const replaceRenderer = ({ bodyComponent, replaceBodyHTMLString }) => {
// React Context in SSR/build
const ConnectedBody = () => <AppProvider>{bodyComponent}</AppProvider>
replaceBodyHTMLString(renderToString(<ConnectedBody />))
}
2019-04-28 22:30:20 +02:00
// Layout with Page Transitions
export const wrapPageElement = wrapPageElementWithLayout