mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-19 06:35:03 +01:00
* 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
30 lines
534 B
JavaScript
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))
|
|
}
|