useDefaultLocale
API Reference for the useDefaultLocale hook
Overview
The useDefaultLocale hook retrieves the application's default locale from the <GTProvider> context.
This locale represents the fallback language for your app and is typically used when a user's preferred locale is unavailable.
Ensure your app is wrapped in a <GTProvider>.
See <GTProvider> for configuration.
If no default locale is specified it defaults to 'en-US'.
Reference
Returns
A string representing the application's default locale, e.g., 'en-US'.
Examples
Basic Usage
Retrieve the application's default locale and display it in your component.
import { useDefaultLocale } from 'gt-react';
export default function DefaultLocale() {
    const defaultLocale = useDefaultLocale();
    return <p>Default locale: {defaultLocale}</p>; // Display the default locale
}Notes
- The useDefaultLocalehook relies on the<GTProvider>to access the context. Ensure your app is wrapped with a provider at the root level.
- Learn more about locale strings here.
Next Steps
How is this guide?

