1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-23 09:42:04 +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'
2019-04-16 21:21:01 +02:00
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