Helpers
useSetLocale
API Reference for the useSetLocale hook
Overview
The useSetLocale hook is used to set the user's locale.
This is client-side only, and it must be wrapped in a <GTProvider> component.
Reference
Returns
A function that sets the user's locale.
Examples
Basic Usage
import { useSetLocale } from 'gt-react';
export default function MyComponent() {
const setLocale = useSetLocale();
return <button onClick={() => setLocale('en')}>Set Locale</button>;
}Notes
- The
useSetLocaleis used to set the user's locale. - Learn more about locale strings here.
Next Steps
- Learn more about the
<GTProvider>component. - Learn more about the
useLocalehook.
How is this guide?