1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-19 06:35:03 +01:00
slate/examples/index.js
Zach Schneider 2ebf3b462b Set up webpack configuration for building examples (#1642)
* Set up webpack configuration for building examples

* Configure react-hot-loader in development

* Improve config, set gh-pages to use examples/dist directory

* PR feedback

* Rename App.js in git
2018-02-21 17:19:56 -08:00

30 lines
534 B
JavaScript

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