Skip to main content
Skip to main content
GDP per capita
FijiTanzaniaWestern SaharaCanada $ 53,400United States $ 85,800KazakhstanUzbekistanPapua New GuineaIndonesia $ 4,900Argentina $ 13,900ChileDemocratic Republic of the CongoSomaliaKenyaSudanChadHaitiDominican RepublicRussia $ 14,900BahamasFalkland IslandsNorwayGreenlandTimor-LesteSouth Africa $ 6,000LesothoMexico $ 14,000UruguayBrazil $ 10,300BoliviaPeruColombiaPanamaCosta RicaNicaraguaHondurasEl SalvadorGuatemalaBelizeVenezuelaGuyanaSurinameFrance $ 46,200EcuadorPuerto RicoJamaicaCubaZimbabweBotswanaNamibiaSenegalMaliMauritaniaBeninNigerNigeria $ 800CameroonTogoGhanaCôted'IvoireGuineaGuinea-BissauLiberiaSierra LeoneBurkina FasoCentral African RepublicRepublic of the CongoGabonEquatorial GuineaZambiaMalawiMozambiqueEswatiniAngolaBurundiIsraelLebanonMadagascarPalestineThe GambiaTunisiaAlgeriaJordanUnited Arab EmiratesQatarKuwaitIraqOmanVanuatuCambodiaThailandLao PDRMyanmarVietnamDem. Rep. KoreaRepublic of Korea $ 36,100MongoliaIndia $ 2,700BangladeshBhutanNepalPakistanAfghanistanTajikistanKyrgyzstanTurkmenistanIranSyriaArmeniaSwedenBelarusUkrainePolandAustriaHungaryMoldovaRomaniaLithuaniaLatviaEstoniaGermany $ 55,800BulgariaGreeceTurkey $ 15,500AlbaniaCroatiaSwitzerlandLuxembourgBelgiumNetherlandsPortugalSpainIrelandNew CaledoniaSolomon IslandsNew ZealandAustralia $ 64,700Sri LankaChina $ 13,300TaiwanItalyDenmarkUnited Kingdom $ 52,600IcelandAzerbaijanGeorgiaPhilippinesMalaysiaBrunei DarussalamSloveniaFinlandSlovakiaCzech RepublicEritreaJapan $ 32,500ParaguayYemenSaudi Arabia $ 33,000Northern CyprusCyprusMoroccoEgypt $ 3,300LibyaEthiopiaDjiboutiSomalilandUgandaRwandaBosnia and HerzegovinaMacedoniaSerbiaMontenegroKosovoTrinidad and TobagoSouth SudanCanada $ 53,400United States $ 85,800Indonesia $ 4,900Argentina $ 13,900Russia $ 14,900South Africa $ 6,000Mexico $ 14,000Brazil $ 10,300France $ 46,200Nigeria $ 800Republic of Korea $ 36,100India $ 2,700Germany $ 55,800Turkey $ 15,500Australia $ 64,700China $ 13,300United Kingdom $ 52,600Japan $ 32,500Saudi Arabia $ 33,000Egypt $ 3,300
import * as React from "react";
import type { CountryContext } from "react-svg-worldmap";
import WorldMap from "react-svg-worldmap";
import { gdpData } from "../data/CountryData";
import { useMapTheme } from "./mapTheme";

export default function App(): JSX.Element {
const theme = useMapTheme();

// Countries with data get darker as the value grows; the rest are a faint
// tint of the border colour, which suits both light and dark mode.
const getStyle = ({ countryValue, maxValue }: CountryContext) => ({
fill: countryValue === undefined ? theme.borderColor : "#22c55e",
fillOpacity:
countryValue === undefined
? 0.12
: 0.25 + 0.75 * (countryValue / maxValue),
stroke: theme.backgroundColor,
strokeWidth: 0.5,
cursor: "pointer",
});

return (
<WorldMap
{...theme}
title="GDP per capita"
valuePrefix="$"
data={gdpData}
styleFunction={getStyle}
/>
);
}