> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lexiconjs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# useLocale()

> Use the `useLocale()` hook to retrieve the user's locale from their device settings.

## Usage

The `useLocale()` hook is helpful for accessing the user's locale based on their device settings in situations where you need the locale string.

You can simply invoke this hook to access the locale string and then pass it around as needed.

For example, if you're working with a package that handles translations separately (like `plaid` or `react-native-date-picker`), you may have to provide the locale to their components.

```tsx theme={null}
import React, { useState } from 'react'
import DatePicker as RNDatePicker from 'react-native-date-picker'
import { useLocale } from '@lexiconjs/react'

export const DatePicker = () => {
  const [date, setDate] = useState(new Date())
  // Example values: en-US, es-ES, etc
  const { locale } = useLocale()

  return (
   <RNDatePicker 
     locale={locale} // Pass it down to other libraries
     date={date} 
     onDateChange={setDate} 
   />
  )
}
```

## Response

This hook returns the locale string.

<ResponseField name="locale" type="string">
  The user's detected locale (based on their current device settings).

  Example: `en-US`
</ResponseField>
