Created
August 6, 2019 15:06
-
-
Save nicolasdanelon/7af57addefbb9f3e77d755270e14500b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
class App extends React { | |
constructor(props) { | |
super(props); | |
this.state = { | |
liveRequest: false, | |
}; | |
} | |
componentDidMount() { | |
setTimeout(() => { | |
this.setState({ liveRequest: true }); | |
}, 5000); | |
} | |
render() { | |
const { liveRequest } = this.state; | |
let loading = `Hello, this is still loading...`; | |
if (liveRequest) { | |
loading = `It's alive!`; | |
} | |
return ( | |
<div className="App"> | |
<h1>{loading}</h1> | |
</div> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment