/* global window, __PRODUCTION__ */
/* eslint no-console: [2, { allow: ["error"] }] */

import React from 'react';
import ReactDOM from 'react-dom';
import {CONTAINER_ID} from 'src/common/constants/application';
import Root from './Root';

const reactRoot = window.document.getElementById(CONTAINER_ID);

ReactDOM.render(<Root />, reactRoot);

if (!__PRODUCTION__ && module.hot) {
  module.hot.accept(() => {
    ReactDOM.render(<Root />, reactRoot);
  });
}

if (__PRODUCTION__) {
  if (!reactRoot.firstChild ||
      !reactRoot.firstChild.attributes ||
      !reactRoot.firstChild.attributes['data-react-checksum']) {
    console.error(
      'Server-side React render was discarded. Make sure that ' +
      'your initial render does not contain any client-side code.'
    );
  }
}

@@ -297,17 +297,41 @@
 ER_ID);%0A
-%0A
+const render = () =%3E %7B%0A  
 ReactDOM
@@ -359,16 +359,30 @@
 ctRoot);
+%0A%7D;%0A%0Arender();
 %0A%0Aif (!_
@@ -436,61 +436,14 @@
 ept(
-() =%3E %7B%0A    ReactDOM.render(%3CRoot /%3E, reactRoot);%0A  %7D
+render
 );%0A%7D

Refactor client entry point