All files / src mount.js

69.57% Statements 16/23
33.33% Branches 2/6
50% Functions 1/2
73.33% Lines 11/15
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 33 34 35 363x 3x 3x 3x 3x   3x   3x               1x 1x 1x     1x                            
import React from 'react'
import {render} from 'react-dom'
import {Provider} from 'react-redux'
import {browserHistory} from 'react-router'
import {syncHistoryWithStore} from 'react-router-redux'
 
import createStore from './store'
 
Iif (process.env.LOGROCKET) {
  const LogRocket = require('logrocket')
  LogRocket.init(process.env.LOGROCKET)
}
 
export function create ({
  app,
  reducers
}) {
  const store = createStore(reducers)
  const history = process.env.NODE_ENV !== 'test'
    ? syncHistoryWithStore(browserHistory, store)
    : {}
  return React.createElement(Provider, {store},
    React.createElement(app, {history, store}))
}
 
export default function mount ({
  app,
  id = 'root',
  reducers
}) {
  return render(
    create({app, reducers}),
    document.getElementById(id)
  )
}