poke-hooks

get pokemon api with react hooks

Usage no npm install needed!

<script type="module">
  import pokeHooks from 'https://cdn.skypack.dev/poke-hooks';
</script>

README

poke-hooks

React Hooks for Pokemon API with Typescript

poke-hooks-example

## usePokemon
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>
  );
};

Types Definition