2017-07-04 03:28:56 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { Provider } from 'react-redux';
|
|
|
|
import { Router } from 'react-router';
|
2017-04-14 06:21:22 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2017-04-12 05:04:27 +00:00
|
|
|
|
|
|
|
export default class Root extends Component {
|
2017-07-04 03:28:56 +00:00
|
|
|
static propTypes = {
|
|
|
|
store: PropTypes.object,
|
|
|
|
history: PropTypes.object,
|
|
|
|
routes: PropTypes.func
|
|
|
|
};
|
2017-04-12 05:04:27 +00:00
|
|
|
|
2017-07-04 03:28:56 +00:00
|
|
|
render() {
|
|
|
|
const { store, history, routes } = this.props;
|
|
|
|
// key={Math.random()} = hack for HMR from https://github.com/webpack/webpack-dev-server/issues/395
|
|
|
|
return (
|
|
|
|
<Provider store={store} key={Math.random()}>
|
|
|
|
<Router history={history} key={Math.random()}>
|
|
|
|
{routes()}
|
|
|
|
</Router>
|
|
|
|
</Provider>
|
|
|
|
);
|
|
|
|
}
|
2017-04-12 05:04:27 +00:00
|
|
|
}
|