Skip to content

Instantly share code, notes, and snippets.

@Waltari10 Waltari10/app.js
Created Nov 9, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.