2016-06-27 22:14:26 +02:00
|
|
|
import React, { PropTypes } from 'react';
|
2016-05-18 19:37:59 +02:00
|
|
|
import { connect } from 'react-redux';
|
2016-06-23 00:36:04 +02:00
|
|
|
import DevTools from './components/DevTools';
|
2016-05-18 19:37:59 +02:00
|
|
|
|
|
|
|
class App extends React.Component {
|
|
|
|
constructor(props, context) {
|
|
|
|
super(props, context);
|
2016-06-24 00:29:55 +02:00
|
|
|
this.state = { isMounted: false };
|
2016-06-23 00:36:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
2016-06-27 23:22:54 +02:00
|
|
|
this.setState({ isMounted: true }); // eslint-disable-line react/no-did-mount-set-state
|
2016-05-18 19:37:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div className="app">
|
2016-06-23 00:36:04 +02:00
|
|
|
{this.state.isMounted && !window.devToolsExtension && process.env.NODE_ENV === 'development' && <DevTools />}
|
2016-06-24 00:29:55 +02:00
|
|
|
{this.props.children}
|
2016-05-18 19:37:59 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-27 22:14:26 +02:00
|
|
|
App.propTypes = {
|
|
|
|
children: PropTypes.object
|
|
|
|
};
|
|
|
|
|
2016-06-24 00:29:55 +02:00
|
|
|
export default connect()(App);
|