forked from Yoast/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrender.js
More file actions
32 lines (27 loc) · 657 Bytes
/
render.js
File metadata and controls
32 lines (27 loc) · 657 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import "babel-polyfill";
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import AppWrapper from "./AppWrapper";
/**
* Renders the given RootElement within an AppWrapper component.
*
* @param {ReactElement} RootElement The RootElement to be wrapped.
*
* @returns {void}
*/
function render( RootElement ) {
ReactDOM.render(
<AppWrapper>
<RootElement />
</AppWrapper>,
document.getElementById( "container" )
);
}
render( App );
if ( module.hot ) {
module.hot.accept( "./App", () => {
const NextRoot = require( "./App" ).default; // eslint-disable-line global-require
render( NextRoot );
} );
}