Root.js
841 Bytes
import React from 'react';
import { Provider } from 'react-redux';
import MyRoutes from '../routes/MyRoutes';
import 'antd/dist/antd.less';
import '../less/index.less';
import { initEnvironment } from '../redux/actions/settingAction';
export default class Root extends React.Component {
constructor(props) {
super(props);
}
static propTypes = {
history: React.PropTypes.object.isRequired,
store: React.PropTypes.object.isRequired
}
componentDidMount() {
const { dispatch } = this.props.store;
dispatch(initEnvironment());
}
get content() {
return (
<MyRoutes history={this.props.history} />
)
}
render() {
return (
<Provider store={this.props.store}>
<div style={{ height: '100vh', width: '100%' }}>
{this.content}
</div>
</Provider>
)
}
}