Data & Utilities·loomora → useCountries

useCountries

Access Loomora’s comprehensive international ISO-3166 database. Look up countries by code, get localized country names, phone dial codes, currency formats, and country flag SVGs.

Interactive live playground

Interact with the hook state and inspect computed return values in real time.

Live
OM

Oman

Calling Code

+968

Currency

OMR (ر.ع.)

Country Lookup

ISO Code"OM"
Popular presetsOM

How to call

Import directly from the Loomora root package in any React client component.

import { useCountries } from 'loomora'

export function CountryInfo({ code }: { code: string }) {
  const { countries, getCountry, getPhoneCode, getCurrency } = useCountries()

  const country = getCountry(code)
  const dialCode = getPhoneCode(code)

  return (
    <div>
      <h3>{country?.name} ({code})</h3>
      <p>Dial Code: +{dialCode}</p>
    </div>
  )
}

Return values & methods

API signatures and utilities returned by this hook.

4 methods
Method / PropTypeDescription
countriesCountry[]Full array of all 240+ countries with metadata.
getCountry(code)(code: string) => Country | undefinedLook up a country by ISO alpha-2 code.
getPhoneCode(code)(code: string) => string | undefinedRetrieve the international dial code for a country.
getCurrency(code)(code: string) => CountryCurrency | undefinedRetrieve official currency symbol and ISO currency code.