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
|