Skip to content

Instantly share code, notes, and snippets.

@nicolasdanelon
Created August 6, 2019 15:06
Show Gist options
  • Save nicolasdanelon/7af57addefbb9f3e77d755270e14500b to your computer and use it in GitHub Desktop.
Save nicolasdanelon/7af57addefbb9f3e77d755270e14500b to your computer and use it in GitHub Desktop.
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