Created
March 19, 2020 01:11
-
-
Save ryanjyost/6d883522abe54b9c9bc708b863bce3fd to your computer and use it in GitHub Desktop.
App
This file contains hidden or 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, { 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