Skip to content

Instantly share code, notes, and snippets.

@ryanjyost
Created March 19, 2020 01:11
Show Gist options
  • Select an option

  • Save ryanjyost/6d883522abe54b9c9bc708b863bce3fd to your computer and use it in GitHub Desktop.

Select an option

Save ryanjyost/6d883522abe54b9c9bc708b863bce3fd to your computer and use it in GitHub Desktop.
App
import React, { useState, useEffect } from "react";
import axios from "axios";
import logo from "./logo.svg";
import "./App.css";
function App() {
const [loaded, setLoaded] = useState(false);
useEffect(() => {
const secondsToWait = 5;
axios(`https://httpstat.us/200?sleep=${secondsToWait * 1000}`).then(
response => {
setLoaded(true);
}
);
}, []);
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
{loaded ? (
<a
className="App-link"
href="https://reactjs.org"
rel="noopener noreferrer"
>
Learn React
</a>
) : null}
</header>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment