import React from "react";
import { useQuery } from "react-query";
import axios from "axios";
import {
Center,
Heading,
Image,
Table,
Thead,
Tbody,
Tr,
Th,
Td,
} from "@chakra-ui/react";
import { Link } from "react-router-dom";
const Player = ({ playerId, players }) => {
const playerStats = useQuery(
`player ${playerId}`,
async () => {
const { data } = await axios.get(`/api/players/${playerId}`);
data.sort((a, b) => a.rank - b.rank);
return data;
},
{
placeholderData: [],
}
);
const playerName = players.data.find((x) => x.id === playerId).name;
return (
<>
Statistic | Rank | Value |
---|---|---|
{x.type} {x.name} | {x.rank} | {x.value} |