Skip to content
On this page

useCountries

Definition

Composable to manage countries

Basic usage

ts
const { 
 getCountries,
 mountedCallback,
 fetchCountries,
 getStatesForCountry 
} = useCountries();

Signature

ts
export function useCountries(): UseCountriesReturn 

Return type

See UseCountriesReturn
ts
export type UseCountriesReturn = {
  mountedCallback(): Promise<void>;
  getCountries: ComputedRef<Country[]>;
  fetchCountries(): Promise<void>;
  getStatesForCountry(countryId: string): CountryState[] | null;
};

Properties

NameTypeDescription
getCountries
ComputedRef<Array<Country>>

Methods

NameTypeDescription
mountedCallback
Promise<void>
fetchCountries
Promise<void>
getStatesForCountry
Array<CountryState> | 
useCountries has loaded