The LocalizationProvider component automatically queries the Storefront API's localization field for the isoCode and name of the country and availableCountries and keeps this information in a context.

Any descendents of this provider can use the useCountry and useAvailableCountries hooks. The isoCode of the country can be used in the Storefront API's @inContext directive as the country value.

Example code

Component type

The LocalizationProvider component is a server component, which means that it renders on the server. For more information about component types, refer to React Server Components.