1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-01 05:16:10 +01:00
slate/examples/index.js
Ian Storm Taylor 257b28aa84
Improve and refactor examples (#1930)
This just refactors the examples to make the styled defined inline with each example, to make it easier to follow for folks. And in the process fixes a few issues that people brought up.

Fixes https://github.com/ianstormtaylor/slate/issues/1920
Fixes https://github.com/ianstormtaylor/slate/issues/1925
2018-07-01 15:13:29 -06:00

33 lines
559 B
JavaScript

import React from 'react'
import ReactDOM from 'react-dom'
import { AppContainer } from 'react-hot-loader'
import App from './app'
import './index.css'
/**
* Render the app.
*/
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)
/**
* Re-render for hot module replacement in development.
*/
if (module.hot) {
module.hot.accept('./app', () => render(App))
}