
import React from 'react';
import ReactDOM from 'react-dom';
import { connect, Provider } from 'react-redux';
import { createStore } from 'redux';
import store from './store';
import { Main } from './components';
import { increment, decrement } from './actions';

function mapStateToProps(state) {
  return {
    value: state
  };
}

function mapDispatchToProps(dispatch) {
  return {
    onClickIncrement: () => {
      dispatch(increment)
    },
    onClickDecrement: () => {
      dispatch(decrement)
    }
  };
}

const MainContainer = connect(mapStateToProps, mapDispatchToProps)(Main);

ReactDOM.render(
  <Provider store={ createStore(store) }>
    <MainContainer />
  </Provider>,
  document.body.appendChild(document.createElement("div")));


import React from 'react';
import ReactDOM from 'react-dom';
import { connect, Provider } from 'react-redux';
import { createStore } from 'redux';
import store from './store';
import { Main } from './components';
import { increment, decrement } from './actions';

const rootNode = document.body.appendChild(document.createElement("div"));

function mapStateToProps(state) {
  return {
    value: state
  };
}

function mapDispatchToProps(dispatch) {
  return {
    onClickIncrement: () => {
      dispatch(increment)
    },
    onClickDecrement: () => {
      dispatch(decrement)
    }
  };
}

const MainContainer = connect(mapStateToProps, mapDispatchToProps)(Main);

function render() {
  ReactDOM.render(
    <Provider store={ createStore(store) }>
      <MainContainer />
    </Provider>,
    rootNode);
}

render();

--- 
+++ 
@@ -6,8 +6,6 @@
 import store from './store';
 import { Main } from './components';
 import { increment, decrement } from './actions';
-
-const rootNode = document.body.appendChild(document.createElement("div"));
 
 function mapStateToProps(state) {
   return {
@@ -28,12 +26,8 @@
 
 const MainContainer = connect(mapStateToProps, mapDispatchToProps)(Main);
 
-function render() {
-  ReactDOM.render(
-    <Provider store={ createStore(store) }>
-      <MainContainer />
-    </Provider>,
-    rootNode);
-}
-
-render();
+ReactDOM.render(
+  <Provider store={ createStore(store) }>
+    <MainContainer />
+  </Provider>,
+  document.body.appendChild(document.createElement("div")));
Simplify even more since we don't need a global reference to rootNode any more, either
