I am trying to add the i18next translation system to my React app and I've already configured everything, but I can't seem to find how to change the language (using a select or a button, for example).
I've followed this easy guide to set the whole thing up. But there's nothing on how to manually change the language. And, as you can see here, there's a function to change the language, but it's inside a function component:
function Page() {
const { t, i18n } = useTranslation();
const changeLanguage = lng => {
i18n.changeLanguage(lng);
};
return ([...])
}
However, my component is a class extending from component and it doesn't seem to work the same way:
class Profile extends Component {
[...]
}
export default withTranslation()(Profile);
How should I do it then? I've no clue.