...

/

useTranslation() Hook

useTranslation() Hook

Learn how to access the translation function or i18n instance inside function components.

Hooks in withTranslation()

The use of the withTranslation() HOC is not constrained to class components but can also be used in function components. However, using the useTranslation() Hook often simplifies the component and makes it much more readable. The Hook can be imported similarly to the HOC:

 ...