Created
June 25, 2020 02:55
-
-
Save djibba22/67710cff965b8f9510474b2802ee3f1b to your computer and use it in GitHub Desktop.
basic app.js component for tutorial
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’; | |
/* Add the hooks to the component before the return method */ | |
const [response, setResponse] = useState(“Before the call”); | |
useEffect(() => { | |
fetch(“http://localhost:8888") | |
.then(res => res.text()) | |
.then(res => { | |
setResponse(res) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment