diff --git a/lib/intermediate-representation-dir/app.js b/lib/intermediate-representation-dir/app.js
index 0242e59e2aae6..9e7abc520cf07 100644
--- a/lib/intermediate-representation-dir/app.js
+++ b/lib/intermediate-representation-dir/app.js
@@ -4,15 +4,18 @@ apiRunner('clientEntry')
import React from 'react'
import ReactDOM from 'react-dom'
-import { AppContainer } from 'react-hot-loader'
+import { AppContainer as HotContainer } from 'react-hot-loader'
const rootElement = document.getElementById(`react-mount`)
let Root = require('./root')
if (Root.default) { Root = Root.default }
+
+// Let site, plugins wrap the site e.g. for Redux.
+const NewRoot = apiRunner('wrapRootComponent', { Root: Root }, Root)
ReactDOM.render(
-
-
- ,
+
+
+ ,
rootElement
)
@@ -20,10 +23,12 @@ if (module.hot) {
module.hot.accept(`./root`, () => {
let NextRoot = require('./root')
if (NextRoot.default) { NextRoot = NextRoot.default }
+ // Let site, plugins wrap the site e.g. for Redux.
+ const NewRoot = apiRunner('wrapRootComponent', { Root: NextRoot }, NextRoot)
ReactDOM.render(
-
-
- ,
+
+
+ ,
rootElement
)
})
diff --git a/lib/intermediate-representation-dir/production-app.js b/lib/intermediate-representation-dir/production-app.js
index 540d2789bd8ca..664c295e22c1a 100644
--- a/lib/intermediate-representation-dir/production-app.js
+++ b/lib/intermediate-representation-dir/production-app.js
@@ -52,11 +52,15 @@ function shouldUpdateScroll (prevRouterProps, { location: { pathname } }) {
}
match({ history: browserHistory, routes: rootRoute }, (error, redirectLocation, renderProps) => {
- ReactDOM.render((
+ const Root = () => (
{apiRunner('onRouteUpdate', currentLocation)}}
/>
+ )
+ const NewRoot = apiRunner('wrapRootComponent', { Root: Root }, Root)
+ ReactDOM.render((
+
), typeof window !== `undefined` ? document.getElementById(`react-mount`) : void 0)
})