Skip to content

Instantly share code, notes, and snippets.

@elsetiyawan
Last active July 10, 2020 10:18
Show Gist options
  • Save elsetiyawan/6414c4617653dafc80374f5a75d48800 to your computer and use it in GitHub Desktop.
Save elsetiyawan/6414c4617653dafc80374f5a75d48800 to your computer and use it in GitHub Desktop.
App.js example in API Call Best Practice
import React from "react";
import "./App.css";
import Api from "./helper/api";
function App() {
const api = new Api();
const fetchUser = () => {
api
.getUserList()
.then((response) => console.log(response))
.catch((err) => console.log(err));
};
return <div className="App"></div>;
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment