Skip to content

Instantly share code, notes, and snippets.

@Waltari10
Created November 9, 2019 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Waltari10/f7b54f7a271aad1fb39c83f008941a77 to your computer and use it in GitHub Desktop.
Save Waltari10/f7b54f7a271aad1fb39c83f008941a77 to your computer and use it in GitHub Desktop.
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