LocalizationProvider
The LocalizationProvider
component automatically queries the Storefront API's localization field for the isoCode
and name
of the country
and keeps this information in a context.
Any descendents of this provider can use the useCountry
hook. The isoCode
of the country
can be used in the Storefront API's @inContext
directive as the country
value.
Example code
Anchor link to section titled "Example code"
Name | Type | Description |
---|---|---|
children | ReactNode |
A ReactNode element. |
preload? | PreloadOptions |
Whether to preload the query. Defaults to false . Specify true to preload the query for the URL or '*' to preload the query for all requests. |
Component type
Anchor link to section titled "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.