Created
November 9, 2019 18:09
-
-
Save Waltari10/f7b54f7a271aad1fb39c83f008941a77 to your computer and use it in GitHub Desktop.
This file contains 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 } from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
function App() { | |
const [response, setResponse] = useState('') | |
return ( | |
<div className="App"> | |
<header className="App-header"> | |
<button | |
onClick={() => { | |
fetch('api/hello-world').then(res => { | |
res.text().then(text => setResponse(text)) | |
}) | |
}} | |
> | |
Say hello! | |
</button> | |
{response} | |
</header> | |
</div> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment