Skip to content

NuroDev/react-pubg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



🐔
react-pubg




React hooks for pubg.ts

Package Version Package Monthly Downloads Docs

🚀 Install

Install it locally in your project

npm i --save react-pubg

# Or with Yarn

yarn add react-pubg

🦄 Usage

Sign for a developer account

You'll first need to sign up on the PUBG developer API site. Using this account you can create a API token

Register an app

With an account created, you can create a new developer application that will provide you with your API key.

Make something!

import { usePlayer } from "react-pubg";

function App() {
  const {
    data: player,
    loading,
    error,
  } = usePlayer({
    apiKey: "...",
    value: "WackyJacky101", // Or an array of player names
  });

  if (loading) return <>Loading...</>;

  if (error) return <>Error fetching player data</>;

  return <pre>{JSON.stringify(player, null, 4)}</pre>;
}