import React from 'react'
import { applyMiddleware, createStore, compose } from 'redux'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { applyRouterMiddleware, browserHistory, Router } from 'react-router'
import { ReduxAsyncConnect } from 'redux-connect'
import { persistState } from 'redux-devtools'
import { routerMiddleware, syncHistoryWithStore } from 'react-router-redux'
import useScroll from 'react-router-scroll'

import PromiseMiddleware from './middlewares/PromiseMiddleware'
import reducers from './reducers'
import routes from './routes'

const initialState = decodeURIComponent(window.__INITIAL_STATE__)
const store = createStore(
  reducers,
  initialState,
  compose(
    applyMiddleware(
      PromiseMiddleware,
      routerMiddleware(browserHistory)
    ),
    window.devToolsExtension && window.devToolsExtension(),
    persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/))
  ),
)

const history = syncHistoryWithStore(browserHistory, store)

render(
  <Provider store={ store }>
    <Router render={ (renderProps) => {
      return (
        <ReduxAsyncConnect { ...renderProps }
          render={ applyRouterMiddleware(useScroll()) } />
      )
    } } history={ history }>
      { routes(store) }
    </Router>
  </Provider>,
  document.getElementById('root')
)
@@ -700,16 +700,19 @@
 State,%0A 
+ //
  compose
@@ -713,16 +713,16 @@
 ompose(%0A
-
     appl
@@ -809,16 +809,20 @@
  ),%0A    
+// (
 window.d
@@ -842,10 +842,19 @@
 ion 
-&&
+%0A    //   ?
  win
@@ -876,19 +876,39 @@
 ension()
-,
 %0A 
+   //   : null),%0A  //
    persi
@@ -975,16 +975,19 @@
 )%5Cb/))%0A 
+ //
  ),%0A)%0A%0Ac

Disable redux devtools for fixing invalid object on mobile browser