1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-20 23:22:56 +01:00
slate/examples/index.js

30 lines
534 B
JavaScript
Raw Permalink Normal View History

2016-06-24 10:22:48 -07:00
import React from 'react'
import ReactDOM from 'react-dom'
import { AppContainer } from 'react-hot-loader'
import App from './app'
import './index.css'
2016-07-12 22:26:57 -07:00
2016-06-24 10:22:48 -07:00
/**
* Mount the router.
2016-06-24 10:22:48 -07:00
*/
const root = window.document.createElement('div')
root.id = 'root'
window.document.body.appendChild(root)
const render = Component => {
ReactDOM.render(
<AppContainer>
<Component />
</AppContainer>,
root
)
2016-06-24 10:22:48 -07:00
}
render(App)
2016-06-24 10:22:48 -07:00
// Webpack Hot Module Replacement API
if (module.hot) {
module.hot.accept('./app', () => render(App))
}