Skip to content

Instantly share code, notes, and snippets.

@djibba22
Created June 25, 2020 02:55
Show Gist options
  • Save djibba22/67710cff965b8f9510474b2802ee3f1b to your computer and use it in GitHub Desktop.
Save djibba22/67710cff965b8f9510474b2802ee3f1b to your computer and use it in GitHub Desktop.
basic app.js component for tutorial
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