Create hello world React app with hot module replacement

This commit is contained in:
2017-06-19 19:20:38 +00:00
parent 5f57586a7f
commit 888eff91d8
8 changed files with 105 additions and 3 deletions

11
src/app.js Normal file
View File

@@ -0,0 +1,11 @@
import React from 'react';
export default class Site extends React.Component {
render() {
return (
<div>
Hello React!
</div>
);
}
}

22
src/index.js Normal file
View File

@@ -0,0 +1,22 @@
import React from 'react';
import ReactDOM from 'react-dom';
import 'react-hot-loader/patch';
import { AppContainer } from 'react-hot-loader';
import App from './app';
const render = Component => {
ReactDOM.render(
<AppContainer>
<Component />
</AppContainer>,
document.getElementById('root')
)
}
render(App)
if (module.hot) {
module.hot.accept('./app', () => { render(App) })
}