Skip to content

Instantly share code, notes, and snippets.

@indreklasn
Created December 5, 2019 19:22
Show Gist options
  • Save indreklasn/cbb2b9394a73151fc5190e9ba619b343 to your computer and use it in GitHub Desktop.
Save indreklasn/cbb2b9394a73151fc5190e9ba619b343 to your computer and use it in GitHub Desktop.
import React, { useEffect, useState } from 'react';
function App() {
const [data, setData] = useState('')
useEffect(() => {
fetch('/.netlify/functions/hello-world')
.then((response) => response.json())
.then(data => setData(data))
.catch(err => console.warn(err.message))
}, [])
return (
<div className="App">
<pre>
{JSON.stringify(data, null, 1 )}
</pre>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment