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
|