diff --git a/twistter-frontend/src/pages/Home.js b/twistter-frontend/src/pages/Home.js index 21fcac5..7ed65d5 100644 --- a/twistter-frontend/src/pages/Home.js +++ b/twistter-frontend/src/pages/Home.js @@ -35,17 +35,20 @@ const styles = { class Home extends Component { state = { - likes: [] + likes: [], + loading: false }; componentDidMount() { + this.setState({loading: true}); axios .get("/getallPosts") .then(res => { // console.log(res.data); this.setState({ - posts: res.data + posts: res.data, + loading: false }); }) .catch(err => console.log(err)); @@ -139,6 +142,7 @@ class Home extends Component { return ( authenticated ? ( + this.state.loading ? () : @@ -147,7 +151,7 @@ class Home extends Component { {postMarkup} - ) : loading ? + ) : loading ? () : (