README
poke-hooks
Pokemon API with Typescript
React Hooks for
usePokemon(name: string | number) : {
data: Pokemon | null;
isLoading: boolean;
}
Example
import { usePokemon } from "poke-hooks";
const Poke = () => {
const { data, isLoading } = usePokemon("pikachu"); // set name or number
if (isLoading) {
return <div>loading... </div>;
}
return (
<div>
<p> name: {data.name} </p>
</div>
);
};