import React from 'react'; import { HashRouter, Route, Switch, Redirect } from 'react-router-dom'; import { Container } from 'reactstrap'; import { hot } from 'react-hot-loader/root'; import ErrorMessages from '../shared/ErrorMessages'; import MainView from './MainView'; import BugDetailsView from './BugDetailsView'; class App extends React.Component { constructor(props) { super(props); // keep track of the mainviews graph and table data so the API won't be // called again when navigating back from bugdetailsview. this.state = { graphData: null, tableData: null, user: {}, errorMessages: [], }; } updateAppState = (state) => { this.setState(state); }; render() { const { user, graphData, tableData, errorMessages } = this.state; return (
{errorMessages.length > 0 && ( )} ( this.setState({ user })} notify={(message) => this.setState({ errorMessages: [message] }) } /> )} /> ( )} />
); } } export default hot(App);