Skip to content

Instantly share code, notes, and snippets.

@JWLangford
Created January 1, 2021 12:33
Show Gist options
  • Save JWLangford/2cce0b1903111350e8852935aabf7b1a to your computer and use it in GitHub Desktop.
Save JWLangford/2cce0b1903111350e8852935aabf7b1a to your computer and use it in GitHub Desktop.
import * as React from "react";
import "./styles.css";
import useTest from "./hook";
export default function App() {
const [getUser, user, errorMessage] = useTest();
return (
<div className="App">
<h1>Simple API Hook Demo</h1>
<button onClick={() => getUser("123")}>Get User</button>
<div>
<h5>{user.name}</h5>
<h6>{user.email}</h6>
<h6>{user.age}</h6>
<h6 style={{ color: "red" }}>{errorMessage}</h6>
</div>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment