// Polyfill
import 'whatwg-fetch'

// Modules
import app from './app'
import debug from 'debug'
import React from 'react'
import hotkey from 'react-hotkey'
import BrowserHistory from 'react-router/lib/BrowserHistory'
import { createElementWithContext } from 'fluxible-addons-react'

import ReactRAFBatchingStrategy from './vendor/react-raf-batching'
ReactRAFBatchingStrategy.inject()

const log = debug('bshed:client')

// needed for onTouchTap
// require('react-tap-event-plugin')()

// Get application node, create application context
const mountNode = document.getElementById('bshed')

// Debug messages
if (process.env.NODE_ENV !== 'production') {
  debug.enable('bshed:*,Fluxible:*')
}

// Rehydrate if global.BSHED is defined
// Otherwise bootstrap with a new context
app.rehydrate(global.BSHED || {}, bootstrap)

/**
 * bootstrap
 * Start router and get everything going
 */
function bootstrap (err, context) {
  if (err) throw err

  // For chrome dev tool support and debugging
  global.context = context
  global.React = React

  // Global hotkeys
  log('activating hotkeys')
  hotkey.activate()

  // Router history
  const history = new BrowserHistory()

  // Start router
  log('starting router')
  React.render(createElementWithContext(context, { history }), mountNode, () => {
    log('React rendered')
  })
}

@@ -50,63 +50,66 @@
 ort 
-app from './app'%0Aimport debug from 'debug'%0Aimport React
+%7B createStore, applyMiddleware, combineReducers, compose %7D
  fro
@@ -113,19 +113,19 @@
 from 're
-act
+dux
 '%0Aimport
@@ -129,33 +129,56 @@
 ort 
-hotkey from 'react-hotkey
+%7B reduxRouteComponent %7D from 'redux-react-router
 '%0Aim
@@ -182,23 +182,16 @@
 %0Aimport 
-Browser
 History 
@@ -240,1009 +240,1789 @@
 ort 
-%7B createElementWithContext %7D from 'fluxible-addons-react'%0A%0Aimport ReactRAFBatchingStrategy from './vendor/react-raf-batching'%0AReactRAFBatchingStrategy.inject()%0A%0Aconst log = debug('bshed:client')%0A%0A// needed for onTouchTap%0A// require('react-tap-event-plugin')()%0A%0A// Get application node, create application context%0Aconst mountNode = document.getElementById('bshed')%0A%0A// Debug messages%0Aif (process.env.NODE_ENV !== 'production') %7B%0A  debug.enable('bshed:*,Fluxible:*')%0A%7D%0A%0A// Rehydrate if global.BSHED is defined%0A// Otherwise bootstrap with a new context%0Aapp.rehydrate(global.BSHED %7C%7C %7B%7D, bootstrap)%0A%0A/**%0A * bootstrap%0A * Start router and get everything going%0A */%0Afunction bootstrap (err, context) %7B%0A  if (err) throw err%0A%0A  // For chrome dev tool support and debugging%0A  global.context = context%0A  global.React = React%0A%0A  // Global hotkeys%0A  log('activating hotkeys')%0A  hotkey.activate()%0A%0A  // Router history%0A 
+* as reducers from './reducers'%0Aimport %7B Router %7D from 'react-router'%0Aimport ReactDOM from 'react-dom'%0Aimport thunk from 'redux-thunk'%0Aimport routes from './routes'%0Aimport React from 'react'%0A%0Aconst %7B DevTools, DebugPanel, LogMonitor %7D = require('redux-devtools/lib/react')%0Aconst %7B devTools, persistState %7D = require('redux-devtools')%0A%0Aconst finalCreateStore = compose(%0A  applyMiddleware(thunk),%0A  devTools(),%0A  persistState(window.location.href.match(/%5B?&%5Ddebug_session=(%5B%5E&%5D+)%5Cb/)),%0A  createStore%0A)%0A%0Aconst reducer = combineReducers(%7B ...reducers %7D)%0Aconst store = finalCreateStore(reducer)%0A%0Aconst wrappedRoutes = %7B%0A  component: reduxRouteComponent(store),%0A  childRoutes: %5B%0A    routes%0A  %5D%0A%7D%0A%0Aconst history = new History()%0AReactDOM.render(%0A  %3Cdiv%3E%0A    %3CRouter history=%7Bhistory%7D routes=%7BwrappedRoutes%7D/%3E%0A    %3CDebugPanel top right bottom key='debugPanel'%3E%0A      %3CDevTools store=%7Bstore%7D monitor=%7BLogMonitor%7D/%3E%0A    %3C/DebugPanel%3E%0A  %3C/div%3E,%0A  document.getElementById('bshed')%0A)%0A%0A// // Polyfill%0A// import 'whatwg-fetch'%0A%0A// // Modules%0A// import %7B createStore, applyMiddleware, combineReducers %7D from 'redux'%0A// import %7B reduxRouteComponent %7D from 'redux-react-router'%0A// import History from 'react-router/lib/BrowserHistory'%0A// import * as reducers from './reducers'%0A// import %7B Router %7D from 'react-router'%0A// import ReactDOM from 'react-dom'%0A// import thunk from 'redux-thunk'%0A// import routes from './routes'%0A// import React from 'react'%0A%0A// const createStoreWithMiddleware = applyMiddleware(thunk)(createStore)%0A// const reducer = combineReducers(%7B ...reducers %7D)%0A//
  const 
-hi
 stor
-y = new BrowserHistory()%0A%0A  // Start router%0A  log('starting router')%0A 
+e = createStoreWithMiddleware(reducer)%0A%0A// const wrappedRoutes = %7B%0A//   component: reduxRouteComponent(store),%0A//   childRoutes: %5B%0A//     routes%0A//   %5D%0A// %7D%0A%0A// const history = new History()%0A//
  React
+DOM
 .render(
 crea
@@ -2021,104 +2021,105 @@
 der(
-createElementWithContext(context, %7B history %7D), mountNode, () =%3E %7B%0A    log('React rendered')%0A  %7D)%0A%7D
+%0A//   %3CRouter history=%7Bhistory%7D routes=%7BwrappedRoutes%7D/%3E,%0A//   document.getElementById('bshed')%0A// )
 %0A

Update index to work with redux