Skip to content

Instantly share code, notes, and snippets.

@Eth3rnit3
Created September 1, 2019 08:58
Show Gist options
  • Save Eth3rnit3/66bb0ce21f299c387abfb57916292323 to your computer and use it in GitHub Desktop.
Save Eth3rnit3/66bb0ce21f299c387abfb57916292323 to your computer and use it in GitHub Desktop.
import React from 'react';
import './App.css';
const fetchTestDatas = function () {
fetch('/api/v1/tests')
.then(res => res.json())
.then((response) => { console.log("Test datas response", response); })
.catch((error) => { console.log("Error while fetching test datas", error); })
}
function App() {
return (
<div className="App">
<button onClick={fetchTestDatas}>
Fetch Test Datas
</button>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment