mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-23 09:42:04 +01:00
14 lines
534 B
JavaScript
14 lines
534 B
JavaScript
import React from 'react'
|
|
import { renderToString } from 'react-dom/server'
|
|
import AppProvider from './src/store/Provider'
|
|
import wrapPageElementWithTransition from './src/helpers/wrapPageElement'
|
|
|
|
export const replaceRenderer = ({ bodyComponent, replaceBodyHTMLString }) => {
|
|
// React Context in SSR/build
|
|
const ConnectedBody = () => <AppProvider>{bodyComponent}</AppProvider>
|
|
replaceBodyHTMLString(renderToString(<ConnectedBody />))
|
|
}
|
|
|
|
// Page Transitions & Layout
|
|
export const wrapPageElement = wrapPageElementWithTransition
|