1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-23 17:50:24 +01:00
portfolio/gatsby-ssr.js

14 lines
534 B
JavaScript
Raw Normal View History

2018-09-16 21:33:42 +02:00
import React from 'react'
import { renderToString } from 'react-dom/server'
import AppProvider from './src/store/provider'
2018-09-14 18:27:49 +02:00
import wrapPageElementWithTransition from './src/helpers/wrapPageElement'
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 />))
}
2018-09-14 20:22:57 +02:00
// Page Transitions & Layout
2018-09-14 18:27:49 +02:00
export const wrapPageElement = wrapPageElementWithTransition