# The useT hook

Sometimes you need to translate other things than plain HTML content. For this reason Magic Translate offers the `useT` hook. You can use it eg. to translate props, like so:

```tsx
const MyComponent = () => {
    const t = useT()

    return (
        <button aria-label={t('Main Menu)}>
            <HamburgerIcon />
        </button>
    )
}
```

You can use the `t()` function literally anywhere inside your component. You could also use it in your template instead of the `<T>` component if you prefer, like so:

```tsx
<const MyComponent = () => {
    const t = useT()

    return (
        <p>{t('This will be translated')}</p>
    )
}
```

### t() function options

You can pass the same options to the `t()` functions as to the `<T>` component, eg. formality:

```tsx
<const MyComponent = () => {
    const t = useT()

    return (
        <button>{t('Please click here', { formality: 'formal' })}</button>
    )
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.magictranslate.io/magic-translate/clients/react/the-uset-hook.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
