simple style, polling

This commit is contained in:
DieMyst
2019-08-18 00:33:06 +03:00
parent e71e01dde5
commit bf455c416c
11 changed files with 279 additions and 105 deletions

View File

@ -1,42 +1,30 @@
import React, { Component, Fragment } from "react";
import { BrowserRouter as Router, Route } from "react-router-dom";
import { connect } from "react-redux";
import { handleInitialData } from "../actions/shared";
import React, {Component, Fragment} from "react";
import {BrowserRouter as Router} from "react-router-dom";
import {connect} from "react-redux";
import LoadingBar from "react-redux-loading"; //importing the loading bar given by react-redux-loading
import Dashboard from "./Dashboard";
import NewMessage from "./NewMessage";
class App extends Component {
componentDidMount() {
this.props.dispatch(handleInitialData());
}
render() {
return (
<Router>
{/* using a fragment so we don't add another element (div) to the DOM */}
<Fragment>
<LoadingBar />
<div className="container">
{this.props.loading === true ? null : (
<div>
<NewMessage />
<Dashboard />
</div>
)}
</div>
</Fragment>
</Router>
);
}
render() {
return (
<Router>
<Fragment>
<LoadingBar />
<div className="container">
{this.props.loading === true ? null : (
<div>
<NewMessage />
<Dashboard />
</div>
)}
</div>
</Fragment>
</Router>
);
}
}
function mapStateToProps({ }) {
return {
};
}
export default connect(mapStateToProps)(App);
export default connect()(App);